我构建了一个 Electron 应用程序,将应用程序与 Electron 打包程序一起打包,并使用Windows-installer构建了安装程序。
去做:
我想在安装应用程序时运行一些命令。
我试过的
将代码放入松鼠事件中以执行命令:
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
如果命令可以成功运行,它将很好地工作。但是,我还需要处理命令失败的情况。在这种情况下,我想停止安装该应用程序,但不能。
有人有什么主意吗?
最佳答案
您是否尝试抛出异常?那不会中止安装吗?
关于build - Electron 应用程序: control squirrel install event,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39258721/