1
0
Fork 0
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:
Roman Khafizianov 2024-12-23 18:04:29 +01:00
parent e6aaeb3177
commit 2d923641e5
No known key found for this signature in database
GPG key ID: F07A7D55A2684852

View file

@ -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();