write failed responses to stderr

This commit is contained in:
Kyle Spearrin 2019-06-04 21:03:26 -04:00
parent 34d8cd5cac
commit f6bb228249
3 changed files with 7 additions and 6 deletions

2
jslib

@ -1 +1 @@
Subproject commit 802d38f52e9794567179b9bd9ffc475ceb31323f
Subproject commit a1823f9931173b982fee10ba4cb84c0ee5078fc3

View File

@ -68,8 +68,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;
});

View File

@ -8,11 +8,12 @@ import { FolderView } from 'jslib/models/view/folderView';
import { NodeUtils } from 'jslib/misc/nodeUtils';
export class CliUtils {
static writeLn(s: string, finalLine: boolean = false) {
static 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');
}
}