diff --git a/ui/desktop/electron-app/src/helpers/spawn-promise.js b/ui/desktop/electron-app/src/helpers/spawn-promise.js index 8835509e0..e057c0498 100644 --- a/ui/desktop/electron-app/src/helpers/spawn-promise.js +++ b/ui/desktop/electron-app/src/helpers/spawn-promise.js @@ -90,9 +90,9 @@ module.exports = { }, }); - const { stdout, stderr } = childProcess; + const { stdout, stderr, error } = childProcess; - return { stdout: stdout?.toString(), stderr: stderr?.toString() }; + return { stdout: stdout?.toString(), stderr: stderr?.toString(), error }; }, /** @@ -111,6 +111,19 @@ module.exports = { resolve({ childProcess, stderr: data.toString() }); }); childProcess.on('error', (err) => reject(err)); + + // In case the process has no stdio and didn't error out, resolve a + // promise once the child process closes so we're not waiting forever. + // Windows doesn't seem to return any error nor any output from stderr when + // a timeout occurs so this guarantees we return a response to the caller. + // Otherwise this should not get hit as we should be returning a response + // from one of the handlers above. + childProcess.on('close', () => + resolve({ + childProcess, + stderr: JSON.stringify({ error: 'Process was closed.' }), + }), + ); }); }, };