javascript - How to open another process after closing the main process in node?
習慣沉默
習慣沉默 2017-05-16 13:45:05
0
1
572

Although this requirement seems a bit illogical, what I need to achieve is an automatic update effect. ZIP downloaded from the server, compressed to another folder, and then close the old version before opening the new version.
Because it is based on NW.JS, it does not support multi-window preview, so before starting a new process (Nw window), you must first close the old process (nw window). Since NW 0.1.3, multiple windows at the same time are not supported. It's on, so. . Quite embarrassing. .
But I think it can definitely meet my needs. After all, there is a NW-AUTOUPDATER that has also been implemented, but it does not meet the project requirements and cannot be used, so I am asking all the experts for advice. Thank you!

習慣沉默
習慣沉默

reply all(1)
某草草

It seems to be similar to the implementation in my framework...
https://github.com/llwslc/ele...

First download the zip package in the background, click upgrade to call the following code

    exec(`start update.exe ${pkgInfo.name} ${process.pid}`, {encoding: 'binary'});
    app.exit(0);

Pass the current path path and program pid to update.exe, and then the program exits...
update.exe will monitor the pid until the pid disappears...
After the pid disappears, update.exe will decompress the zip package...
After decompression is completed, restart the main program and exit by yourself...

Just unzip directly under mac, no need to start a new program...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!