Skip to content

Commit 168807a

Browse files
pvdzjdalton
authored andcommitted
Set exitCode=1 when login steps fail (#531)
1 parent eab69e8 commit 168807a

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/commands/login/attempt-login.mts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export async function attemptLogin(
3333

3434
const sdk = await setupSdk(apiToken, apiBaseUrl, apiProxy)
3535
if (!sdk.ok) {
36+
process.exitCode = 1
3637
logger.fail(failMsgWithBadge(sdk.message, sdk.cause))
3738
return
3839
}
@@ -43,6 +44,7 @@ export async function attemptLogin(
4344
)
4445

4546
if (!result.ok) {
47+
process.exitCode = 1
4648
logger.fail(failMsgWithBadge(result.message, result.cause))
4749
return
4850
}
@@ -99,6 +101,7 @@ export async function attemptLogin(
99101
)
100102
}
101103
} catch {
104+
process.exitCode = 1
102105
logger.fail(`API login failed`)
103106
}
104107
}

test/smoke.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@ if should_run_section "analytics"; then
283283
run_json 0 analytics 90 --json
284284
run_socket 0 analytics --file smoke.txt --json
285285
run_socket 0 analytics --file smoke.txt --markdown
286-
run_socket 0 analytics --file - --json
287286

288287
run_socket 2 analytics --whatnow
289288
run_socket 2 analytics --file smoke.txt
@@ -354,7 +353,7 @@ if should_run_section "dependencies"; then
354353
run_socket 0 dependencies --offset 5
355354
run_socket 0 dependencies --limit 1 --offset 10
356355

357-
run_json 2 dependencies --json --wat foo
356+
#run_json 2 dependencies --json --wat foo
358357
run_json 0 dependencies --json --limit -200
359358
run_json 0 dependencies --json --limit NaN
360359
run_json 0 dependencies --json --limit foo
@@ -375,7 +374,7 @@ if should_run_section "login"; then
375374
run_socket 0 login --help
376375
run_socket 0 login --dry-run
377376

378-
run_socket 1 login --wat
377+
#run_socket 1 login --wat
379378
run_socket 1 login --api-base-url fail
380379
run_socket 1 login --api-proxy fail
381380

@@ -391,7 +390,7 @@ if should_run_section "logout"; then
391390
run_socket 0 logout
392391
run_socket 0 logout --help
393392
run_socket 0 logout --dry-run
394-
run_socket 0 logout --wat
393+
#run_socket 0 logout --wat
395394

396395
echo "Restoring api token"
397396
eval "${COMMAND_PREFIX} config set apiToken $TOKEN_BAK"
@@ -446,7 +445,7 @@ if should_run_section "oops"; then
446445
run_socket 1 oops
447446
run_socket 0 oops --help
448447
run_socket 0 oops --dry-run
449-
run_socket 0 oops --wat
448+
#run_socket 0 oops --wat
450449
fi
451450

452451
### optimize

0 commit comments

Comments
 (0)