diff --git a/src/vs/code/node/cli.ts b/src/vs/code/node/cli.ts index 040144f4c9d..c93e5a6169e 100644 --- a/src/vs/code/node/cli.ts +++ b/src/vs/code/node/cli.ts @@ -157,41 +157,39 @@ export async function main(argv: string[]): Promise { // stdin. We do this because there is no reliable way to find out if data is piped to stdin. Just // checking for stdin being connected to a TTY is not enough (https://github.com/microsoft/vscode/issues/40351) - if (args._.length === 0) { - if (hasReadStdinArg) { - stdinFilePath = getStdinFilePath(); + if (hasReadStdinArg) { + stdinFilePath = getStdinFilePath(); - // returns a file path where stdin input is written into (write in progress). - try { - readFromStdin(stdinFilePath, !!verbose); // throws error if file can not be written + // returns a file path where stdin input is written into (write in progress). + try { + readFromStdin(stdinFilePath, !!verbose); // throws error if file can not be written - // Make sure to open tmp file - addArg(argv, stdinFilePath); + // Make sure to open tmp file + addArg(argv, stdinFilePath); - // Enable --wait to get all data and ignore adding this to history - addArg(argv, '--wait'); - addArg(argv, '--skip-add-to-recently-opened'); - args.wait = true; + // Enable --wait to get all data and ignore adding this to history + addArg(argv, '--wait'); + addArg(argv, '--skip-add-to-recently-opened'); + args.wait = true; - console.log(`Reading from stdin via: ${stdinFilePath}`); - } catch (e) { - console.log(`Failed to create file to read via stdin: ${e.toString()}`); - stdinFilePath = undefined; - } - } else { - - // If the user pipes data via stdin but forgot to add the "-" argument, help by printing a message - // if we detect that data flows into via stdin after a certain timeout. - processCallbacks.push(_ => stdinDataListener(1000).then(dataReceived => { - if (dataReceived) { - if (isWindows) { - console.log(`Run with '${product.applicationName} -' to read output from another program (e.g. 'echo Hello World | ${product.applicationName} -').`); - } else { - console.log(`Run with '${product.applicationName} -' to read from stdin (e.g. 'ps aux | grep code | ${product.applicationName} -').`); - } - } - })); + console.log(`Reading from stdin via: ${stdinFilePath}`); + } catch (e) { + console.log(`Failed to create file to read via stdin: ${e.toString()}`); + stdinFilePath = undefined; } + } else { + + // If the user pipes data via stdin but forgot to add the "-" argument, help by printing a message + // if we detect that data flows into via stdin after a certain timeout. + processCallbacks.push(_ => stdinDataListener(1000).then(dataReceived => { + if (dataReceived) { + if (isWindows) { + console.log(`Run with '${product.applicationName} -' to read output from another program (e.g. 'echo Hello World | ${product.applicationName} -').`); + } else { + console.log(`Run with '${product.applicationName} -' to read from stdin (e.g. 'ps aux | grep code | ${product.applicationName} -').`); + } + } + })); } }