1
0
mirror of https://github.com/bitwarden/directory-connector synced 2025-12-19 17:53:20 +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

2
jslib

Submodule jslib updated: 802d38f52e...a1823f9931

View File

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