Answer stability round 1: 0 🔴, 2 🟡 (0 misread); name the signed-out check beside its message, and report a signal as a shell does; the 🟢 for a claude that cannot start is declined, as the home's build fails first
This commit is contained in:
@@ -2,15 +2,17 @@ import pathlib
|
||||
import sys
|
||||
|
||||
from loop_effects.effects import Effects
|
||||
from claude_home.home import SIGNED_OUT
|
||||
from claude_home.home import only_signed_out
|
||||
|
||||
|
||||
# The spelling, a command of its own beside build-release: a panel of readers seated as the README's audience rejected `build-release claude`, since build-release reads every word after its name as a task, so a task that starts with "claude" would mean something else. They picked the name that opens with the word they look for.
|
||||
# A command of its own, since `build-release claude` would take a task that starts with "claude" for this command.
|
||||
def main(argv: list[str], cwd: pathlib.Path, effects: Effects) -> int:
|
||||
"""Runs claude on the terminal in cwd with argv as its arguments, in the loop's Claude home with the release's tools first on `PATH`, which the effect sets for every claude it starts. Returns claude's exit code, or 1 where the home cannot be built."""
|
||||
"""Runs claude on the terminal in cwd with argv as its arguments, in the loop's Claude home. Returns claude's exit code as a shell reports it, or 1 where the home isn't ready for a reason other than a missing sign-in."""
|
||||
not_ready = effects.claude_home()
|
||||
# Where nobody has signed in yet, the login is typed in this claude.
|
||||
if not_ready and not not_ready.startswith(SIGNED_OUT):
|
||||
# A missing sign-in doesn't stop it: the login is typed in this claude.
|
||||
if not_ready and not only_signed_out(not_ready):
|
||||
print(not_ready, file=sys.stderr)
|
||||
return 1
|
||||
return effects.claude_on_terminal(argv, str(cwd), {})
|
||||
code = effects.claude_on_terminal(argv, str(cwd), {})
|
||||
# subprocess reports a claude that a signal ended as minus the signal's number, which sys.exit would turn into 256 minus it.
|
||||
return 128 - code if code < 0 else code
|
||||
|
||||
Reference in New Issue
Block a user