我构建了一个电子应用程序,使用electronic-packager打包应用程序,并使用windows-installer构建安装程序。
TODO: 我想在安装应用程序期间运行一些命令。
我尝试了什么:
将代码放在squirrel事件中以执行命令:
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
如果命令可以成功运行,它运行良好。但是,我还需要处理命令失败的情况。在这种情况下,我想停止安装应用程序,但它不能。
有没有人有任何想法?
答案 0 :(得分:0)
您是否尝试过抛出异常?不会中止安装?