Merge pull request #39 from Microsoft/exit-code

Return Exit Code 1 for failled commands
This commit is contained in:
Geoffrey Goh 2015-11-03 14:27:39 -08:00
Родитель e2d633adce b149ec5388
Коммит f8291d2307
2 изменённых файлов: 9 добавлений и 12 удалений

Просмотреть файл

@ -12,8 +12,11 @@ function run(): void {
}
execute(parser.command)
.catch((error: any): void => console.error(chalk.red("[Error] " + error.message)))
.catch((error: any): void => {
console.error(chalk.red("[Error] " + error.message));
process.exit(1);
})
.done();
}
run();
run();

Просмотреть файл

@ -111,9 +111,7 @@ function accessKeyList(command: cli.IAccessKeyListCommand): Promise<void> {
}
function removeLocalAccessKey(): Promise<void> {
return Promise<void>((resolve, reject, notify): void => {
log(chalk.red("[Error] Cannot remove the access key for the current session. Please run 'code-push logout' if you would like to remove this access key."));
});
return Q.fcall(() => { throw new Error("Cannot remove the access key for the current session. Please run 'code-push logout' if you would like to remove this access key."); });
}
function accessKeyRemove(command: cli.IAccessKeyRemoveCommand): Promise<void> {
@ -299,9 +297,7 @@ function deserializeConnectionInfo(): IStandardLoginConnectionInfo|IAccessKeyLog
}
function notifyAlreadyLoggedIn(): Promise<void> {
return Promise<void>((resolve, reject, notify): void => {
log("You are already logged in from this machine.");
});
return Q.fcall(() => { throw new Error("You are already logged in from this machine."); });
}
export function execute(command: cli.ICommand): Promise<void> {
@ -494,9 +490,7 @@ function loginWithAccessTokenInternal(serverUrl: string): Promise<void> {
}
if (!accessToken) {
log("Invalid access token.");
return;
throw new Error("Invalid access token.");
}
sdk = new AccountManager(serverUrl);
@ -531,7 +525,7 @@ function logout(): Promise<void> {
});
}
return Q(<void>null);
return Q.fcall(() => { throw new Error("You are not logged in."); });
}
function printDeploymentList(command: cli.IDeploymentListCommand, deployments: Deployment[], deploymentKeys: Array<string>): void {