-
Notifications
You must be signed in to change notification settings - Fork 403
run.py: stop hiding sandbox and recommend --debug on sandbox failure #4068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,14 +106,22 @@ | |
| raise subprocess.CalledProcessError(rc, ["self"]) | ||
|
|
||
|
|
||
| def log_sandbox_issue(sandbox: Sequence[str], cmdline: Sequence[str], errmsg: str) -> None: | ||
| if ARG_DEBUG.get(): | ||
| # Complete but very long and hard to read. It could be reusable. | ||
| logging.error(f"{shlex.join(['mkosi-sandbox', *sandbox, *cmdline])}") | ||
| else: | ||
| logging.error("sandbox command omitted, rerun with --debug to see full command with bind mounts") | ||
| logging.error(f"{shlex.join(cmdline)}") | ||
|
Comment on lines
+110
to
+115
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please stick to a single call to "sandbox details omitted, rerun with --debug to see the full sandbox command."
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
So are you ok with printing the error message on a separate line? Adding just one newline. Not 100% clear to me from the above, sorry. I tested this PR heavily (especially compared to how small of a code change it is...) and NOT having the error message trailing a 5-10 lines-long command made a massive difference. It's quite painful to find before this PR. I don't mind the code style and the number of logging statements, the terminal output and "user experience" is really the purpose of this. |
||
|
|
||
| logging.error(errmsg) | ||
|
|
||
|
|
||
| def log_process_failure(sandbox: Sequence[str], cmdline: Sequence[str], returncode: int) -> None: | ||
| if -returncode in (signal.SIGINT, signal.SIGTERM): | ||
| logging.error(f"Interrupted by {signal.Signals(-returncode).name} signal") | ||
| elif returncode < 0: | ||
| logging.error( | ||
| f'"{shlex.join(["mkosi-sandbox", *sandbox, *cmdline] if ARG_DEBUG.get() else cmdline)}"' | ||
| f" was killed by {signal.Signals(-returncode).name} signal." | ||
| ) | ||
| log_sandbox_issue(sandbox, cmdline, f" was killed by {signal.Signals(-returncode).name} signal.") | ||
| elif returncode == 127 and cmdline[0] != "mkosi": | ||
| # Anything invoked beneath /work is a script that we mount into place (so we know it exists). If one | ||
| # of these scripts fails with exit code 127, it's either because the script interpreter was not | ||
|
|
@@ -126,10 +134,7 @@ | |
| else: | ||
| logging.error(f"{cmdline[0]} not found.") | ||
| else: | ||
| logging.error( | ||
| f'"{shlex.join(["mkosi-sandbox", *sandbox, *cmdline] if ARG_DEBUG.get() else cmdline)}"' | ||
| f" returned non-zero exit code {returncode}." | ||
| ) | ||
| log_sandbox_issue(sandbox, cmdline, f" returned non-zero exit code {returncode}.") | ||
|
|
||
|
|
||
| def run( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.