mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 06:47:41 +03:00
server: do not crash on xdg-open failure
Summary: Previously, clicking a file could crash the isl-server process like: open file /home/quark/tmp/erepos/rs/isl/y.txt node:events:491 throw er; // Unhandled 'error' event ^ Error: spawn xdg-open ENOENT at ChildProcess._handle.onexit (node:internal/child_process:283:19) at onErrorNT (node:internal/child_process:476:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) Emitted 'error' event on ChildProcess instance at: at ChildProcess._handle.onexit (node:internal/child_process:289:12) at onErrorNT (node:internal/child_process:476:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -2, code: 'ENOENT', syscall: 'spawn xdg-open', path: 'xdg-open', spawnargs: [ '/home/quark/tmp/erepos/rs/isl/y.txt' ] } Node.js v18.16.0 Fix it by not letting the error propagate to the top-level handler. Reviewed By: zzl0 Differential Revision: D45800641 fbshipit-source-id: 0f028f71d20c29dafd8395bc12ec23a937264224
This commit is contained in:
parent
c5eb6448c9
commit
93e3939e72
@ -82,6 +82,10 @@ export const browserServerPlatform: ServerPlatform = {
|
|||||||
windowsHide: false,
|
windowsHide: false,
|
||||||
windowsVerbatimArguments: true,
|
windowsVerbatimArguments: true,
|
||||||
});
|
});
|
||||||
|
// Silent error. Don't crash the server process.
|
||||||
|
proc.on('error', err => {
|
||||||
|
repo?.logger.log('failed to open', path, err);
|
||||||
|
});
|
||||||
proc.unref();
|
proc.unref();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user