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;