mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
more error handling
This commit is contained in:
parent
6c9439ac70
commit
515f895ed3
1 changed files with 15 additions and 24 deletions
|
@ -111,37 +111,28 @@ app.whenReady().then(() => {
|
|||
console.log("Unhandled OS Platform: ", platform());
|
||||
break;
|
||||
}
|
||||
|
||||
console.log("serverPath:", serverPath);
|
||||
//Start daemon binary if it exists
|
||||
if (existsSync(serverPath)) {
|
||||
console.log("Starting freedata-server binary");
|
||||
console.log("serverPath:", serverPath);
|
||||
console.log("CWD:", join(serverPath, ".."));
|
||||
|
||||
console.log(`Starting server with path: ${serverPath}`);
|
||||
serverProcess = spawn(serverPath, [], { shell: true });
|
||||
|
||||
// return process messages
|
||||
serverProcess.on("error", (err) => {
|
||||
//serverProcessLog.error(`error when starting daemon: ${err}`);
|
||||
console.log(err);
|
||||
serverProcess.on('error', (err) => {
|
||||
console.error('Failed to start server process:', err);
|
||||
});
|
||||
serverProcess.on("message", () => {
|
||||
// serverProcessLog.info(`${data}`);
|
||||
serverProcess.stdout.on('data', (data) => {
|
||||
console.log(`stdout: ${data}`);
|
||||
});
|
||||
serverProcess.stdout.on("data", () => {
|
||||
// serverProcessLog.info(`${data}`);
|
||||
});
|
||||
serverProcess.stderr.on("data", (data) => {
|
||||
// serverProcessLog.info(`${data}`);
|
||||
console.log(data);
|
||||
});
|
||||
serverProcess.on("close", (code) => {
|
||||
// serverProcessLog.warn(`serverProcess exited with code ${code}`);
|
||||
|
||||
serverProcess.stderr.on('data', (data) => {
|
||||
console.error(`stderr: ${data}`);
|
||||
});
|
||||
|
||||
|
||||
} else {
|
||||
serverProcess = null;
|
||||
serverPath = null;
|
||||
console.log("Daemon binary doesn't exist--normal for dev environments.");
|
||||
console.log("Server binary doesn't exist in setup folder");
|
||||
}
|
||||
|
||||
//)
|
||||
|
|
Loading…
Reference in a new issue