Commit 22e387e1 authored by 神楽坂玲奈's avatar 神楽坂玲奈

aria2c

parent b5d74f88
...@@ -90,13 +90,14 @@ function createAria2c() { ...@@ -90,13 +90,14 @@ function createAria2c() {
default: default:
throw 'unsupported platform'; throw 'unsupported platform';
} }
const aria2c = child_process.spawn(aria2c_path, ['--enable-rpc', '--rpc-allow-origin-all'], {detached: true}); let aria2c = child_process.spawn(aria2c_path, ['--enable-rpc', '--rpc-allow-origin-all']);
aria2c.on('data', (data)=> { aria2c.on('data', (data)=> {
console.log(data); console.log(data);
}) })
return aria2c;
} }
createAria2c(); const aria2c = createAria2c();
// Keep a global reference of the window object, if you don't, the window will // Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected. // be closed automatically when the JavaScript object is garbage collected.
...@@ -133,11 +134,7 @@ app.on('ready', createWindow) ...@@ -133,11 +134,7 @@ app.on('ready', createWindow)
// Quit when all windows are closed. // Quit when all windows are closed.
app.on('window-all-closed', function () { app.on('window-all-closed', function () {
// On OS X it is common for applications and their menu bar app.quit()
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
}) })
app.on('activate', function () { app.on('activate', function () {
...@@ -151,3 +148,9 @@ app.on('activate', function () { ...@@ -151,3 +148,9 @@ app.on('activate', function () {
// In this file you can include the rest of your app's specific main process // In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here. // code. You can also put them in separate files and require them here.
app.on('quit', ()=> {
// windows 在非 detach 模式下会自动退出子进程
if (process.platform != 'win32') {
aria2c.kill()
}
})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment