Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Commit 88241fc

Browse files
committed
j: return exit code properly
fixes the bug of j tmt always returning 0 click in standalone_mode=False mode, as we use it in j, will not raise the click.Exception.Exit but instead return the result as an integer. this commit looks for the integer, and raisex the exception that can be caught on the external try block.
1 parent ec806a0 commit 88241fc

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • packages/jumpstarter-cli/jumpstarter_cli

packages/jumpstarter-cli/jumpstarter_cli/j.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ async def cli():
2626
async with BlockingPortal() as portal:
2727
with ExitStack() as stack:
2828
async with env_async(portal, stack) as client:
29-
await to_thread.run_sync(lambda: client.cli()(standalone_mode=False))
29+
result = await to_thread.run_sync(lambda: client.cli()(standalone_mode=False))
30+
if isinstance(result, int) and result != 0:
31+
raise BaseExceptionGroup("CLI exit", [click.exceptions.Exit(result)])
3032
except BaseExceptionGroup as eg:
3133
# Handle exceptions wrapped in ExceptionGroup (e.g., from task groups)
3234
if exc := find_exception_in_group(eg, EnvironmentVariableNotSetError):
@@ -40,6 +42,9 @@ async def cli():
4042
await cli()
4143
finally:
4244
tg.cancel_scope.cancel()
45+
except* click.exceptions.Exit as excgroup:
46+
for exc in leaf_exceptions(excgroup):
47+
sys.exit(exc.exit_code)
4348
except* click.ClickException as excgroup:
4449
for exc in leaf_exceptions(excgroup):
4550
cast(click.ClickException, exc).show()

0 commit comments

Comments
 (0)