1
0
mirror of https://github.com/bitwarden/directory-connector synced 2025-12-18 09:13:28 +00:00

write failed responses to stderr

This commit is contained in:
Kyle Spearrin
2019-06-04 21:03:30 -04:00
parent b217ac9456
commit a06212af1a
2 changed files with 7 additions and 6 deletions

View File

@@ -20,11 +20,12 @@ import { Response } from 'jslib/cli/models/response';
import { StringResponse } from 'jslib/cli/models/response/stringResponse';
const chalk = chk.default;
const writeLn = (s: string, finalLine: boolean = false) => {
const writeLn = (s: string, finalLine: boolean = false, error: boolean = false) => {
const stream = error ? process.stderr : process.stdout;
if (finalLine && process.platform === 'win32') {
process.stdout.write(s);
stream.write(s);
} else {
process.stdout.write(s + '\n');
stream.write(s + '\n');
}
};
@@ -58,8 +59,8 @@ export class Program extends BaseProgram {
});
program.on('command:*', () => {
writeLn(chalk.redBright('Invalid command: ' + program.args.join(' ')));
writeLn('See --help for a list of available commands.', true);
writeLn(chalk.redBright('Invalid command: ' + program.args.join(' ')), false, true);
writeLn('See --help for a list of available commands.', true, true);
process.exitCode = 1;
});