我构建了一个电子应用程序,使用 electron-packager 打包应用程序并使用 windows-installer 构建安装程序。
Todo:我想在安装应用程序期间运行一些命令。
我尝试了什么:
将代码放入松鼠事件中以执行命令:
case '--squirrel-install':
const exec = require('child_process).exec;
exec(...); // run command here to execute commands inside batch file
if (error) {make installation fail} // if there is an error during exec(), fail the installation
如果命令可以成功运行,则效果很好。但是,我还需要处理命令失败的情况。在这种情况下,我想停止安装该应用程序,但它不能。
有人有什么主意吗?