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
|
@ -111,37 +111,28 @@ app.whenReady().then(() => {
|
||||||
console.log("Unhandled OS Platform: ", platform());
|
console.log("Unhandled OS Platform: ", platform());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
console.log("serverPath:", serverPath);
|
||||||
//Start daemon binary if it exists
|
//Start daemon binary if it exists
|
||||||
if (existsSync(serverPath)) {
|
if (existsSync(serverPath)) {
|
||||||
console.log("Starting freedata-server binary");
|
console.log(`Starting server with path: ${serverPath}`);
|
||||||
console.log("serverPath:", serverPath);
|
|
||||||
console.log("CWD:", join(serverPath, ".."));
|
|
||||||
|
|
||||||
serverProcess = spawn(serverPath, [], { shell: true });
|
serverProcess = spawn(serverPath, [], { shell: true });
|
||||||
|
|
||||||
// return process messages
|
serverProcess.on('error', (err) => {
|
||||||
serverProcess.on("error", (err) => {
|
console.error('Failed to start server process:', err);
|
||||||
//serverProcessLog.error(`error when starting daemon: ${err}`);
|
|
||||||
console.log(err);
|
|
||||||
});
|
});
|
||||||
serverProcess.on("message", () => {
|
serverProcess.stdout.on('data', (data) => {
|
||||||
// serverProcessLog.info(`${data}`);
|
console.log(`stdout: ${data}`);
|
||||||
});
|
});
|
||||||
serverProcess.stdout.on("data", () => {
|
|
||||||
// serverProcessLog.info(`${data}`);
|
serverProcess.stderr.on('data', (data) => {
|
||||||
});
|
console.error(`stderr: ${data}`);
|
||||||
serverProcess.stderr.on("data", (data) => {
|
|
||||||
// serverProcessLog.info(`${data}`);
|
|
||||||
console.log(data);
|
|
||||||
});
|
|
||||||
serverProcess.on("close", (code) => {
|
|
||||||
// serverProcessLog.warn(`serverProcess exited with code ${code}`);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
serverProcess = null;
|
serverProcess = null;
|
||||||
serverPath = 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