Fixed exit code issues with promises

This commit is contained in:
Logan Ramos 2019-07-05 11:27:58 -07:00
parent f75b94c9be
commit 6432f0bfb7

View file

@ -73,7 +73,7 @@ export class TerminalProcess implements ITerminalChildProcess, IDisposable {
return Promise.reject(SHELL_CWD_INVALID_EXIT_CODE); return Promise.reject(SHELL_CWD_INVALID_EXIT_CODE);
} }
return; return;
}).catch((err) => { }, err => {
if (err && err.code === 'ENOENT') { if (err && err.code === 'ENOENT') {
// So we can include in the error message the specified CWD // So we can include in the error message the specified CWD
shellLaunchConfig.cwd = cwd; shellLaunchConfig.cwd = cwd;
@ -87,7 +87,7 @@ export class TerminalProcess implements ITerminalChildProcess, IDisposable {
return Promise.reject(stat.isDirectory() ? SHELL_PATH_DIRECTORY_EXIT_CODE : SHELL_PATH_INVALID_EXIT_CODE); return Promise.reject(stat.isDirectory() ? SHELL_PATH_DIRECTORY_EXIT_CODE : SHELL_PATH_INVALID_EXIT_CODE);
} }
return; return;
}).catch(async (err) => { }, async (err) => {
if (err && err.code === 'ENOENT') { if (err && err.code === 'ENOENT') {
let cwd = shellLaunchConfig.cwd instanceof URI ? shellLaunchConfig.cwd.path : shellLaunchConfig.cwd!; let cwd = shellLaunchConfig.cwd instanceof URI ? shellLaunchConfig.cwd.path : shellLaunchConfig.cwd!;
const executable = await findExecutable(shellLaunchConfig.executable!, cwd); const executable = await findExecutable(shellLaunchConfig.executable!, cwd);
@ -95,7 +95,6 @@ export class TerminalProcess implements ITerminalChildProcess, IDisposable {
return Promise.reject(SHELL_PATH_INVALID_EXIT_CODE); return Promise.reject(SHELL_PATH_INVALID_EXIT_CODE);
} }
} }
return;
}); });
Promise.all([cwdVerification, exectuableVerification]).then(() => { Promise.all([cwdVerification, exectuableVerification]).then(() => {