mirror of
https://git.tuxpa.in/a/code-server.git
synced 2024-12-27 04:35:25 +00:00
Exit when pipe closes
This allows piping to things like `head` without SIGPIPE errors.
This commit is contained in:
parent
c11d5fe9e6
commit
2470081789
@ -229,6 +229,12 @@ const main = async(): Promise<boolean | void | void[]> => {
|
||||
return startCli() || new WrapperProcess().start();
|
||||
};
|
||||
|
||||
// It's possible that the pipe has closed (for example if you run code-server
|
||||
// --version | head -1). Assume that means we're done.
|
||||
if (!process.stdout.isTTY) {
|
||||
process.stdout.on("error", () => process.exit());
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
logger.error(error.message);
|
||||
process.exit(typeof error.code === "number" ? error.code : 1);
|
||||
|
Loading…
Reference in New Issue
Block a user