mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-08 14:07:01 +09:00
send shutdown to stdin instead of os signal(kill) on windows
This commit is contained in:
parent
e6aaeb3177
commit
2d923641e5
1 changed files with 8 additions and 2 deletions
|
@ -7,6 +7,7 @@ const { app, dialog, shell } = require('electron');
|
|||
const Util = require('./util.js');
|
||||
|
||||
let maxStdErrChunksBuffer = 10;
|
||||
const winShutdownStdinMessage = 'shutdown\n';
|
||||
|
||||
class Server {
|
||||
|
||||
|
@ -114,7 +115,12 @@ class Server {
|
|||
});
|
||||
|
||||
this.stopTriggered = true;
|
||||
this.cp.kill(signal);
|
||||
if (process.platform === 'win32') {
|
||||
// it is not possible to handle os signals on windows, so we can't do graceful shutdown on go side
|
||||
this.cp.stdin.write(winShutdownStdinMessage);
|
||||
} else {
|
||||
this.cp.kill(signal);
|
||||
}
|
||||
} else {
|
||||
resolve();
|
||||
};
|
||||
|
@ -131,4 +137,4 @@ class Server {
|
|||
|
||||
};
|
||||
|
||||
module.exports = new Server();
|
||||
module.exports = new Server();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue