From 5759d05745342eb8efe8fd611ca337ef0d4eafb7 Mon Sep 17 00:00:00 2001 From: Peter Belbin Date: Fri, 1 Nov 2019 11:17:52 -0500 Subject: [PATCH] Add missing shelljs.exec option (#40048) * Add missing shelljs.exec option * Add test for fatal being true and false * Standardize layout * Formatting improvement * Take stdout from the correct variable * Add missing period --- types/shelljs/index.d.ts | 7 +++++++ types/shelljs/shelljs-tests.ts | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/types/shelljs/index.d.ts b/types/shelljs/index.d.ts index 7557ddae22..ccfd678d88 100644 --- a/types/shelljs/index.d.ts +++ b/types/shelljs/index.d.ts @@ -835,6 +835,13 @@ export interface ExecOptions extends child.ExecOptions { */ silent?: boolean; + /** + * Exit when command return code is non-zero. + * + * @default false + */ + fatal?: boolean; + /** * Asynchronous execution. * diff --git a/types/shelljs/shelljs-tests.ts b/types/shelljs/shelljs-tests.ts index b7b7afc5b1..8bebdca4db 100644 --- a/types/shelljs/shelljs-tests.ts +++ b/types/shelljs/shelljs-tests.ts @@ -92,6 +92,14 @@ const version = shell.exec("node --version").stdout; const version2 = shell.exec("node --version", {async: false}); const output = version2.stdout; +// $ExpectType ShellString +const version3 = shell.exec("node --version", {async: false, fatal: false}); +const output3 = version3.stdout; + +// $ExpectType ShellString +const version4 = shell.exec("node --version", {async: false, fatal: true}); +const output4 = version4.stdout; + // $ExpectType ChildProcess const asyncVersion3 = shell.exec("node --version", {async: true}); let pid = asyncVersion3.pid;