Skip to content
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

Show an error if the command fails to spawn #286

Merged
merged 2 commits into from
Dec 25, 2024
Merged

Conversation

jyn514
Copy link
Contributor

@jyn514 jyn514 commented Dec 25, 2024

Before, bacon showed no output at all if spawning failed. Now, it gives a useful error instead:

Error: error in computation for job 'run'

Caused by:
    0: failed to spawn cd "../example" && CARGO_TERM_COLOR="always" RUST_BACKTRACE="0" "./run.sh"
    1: Exec format error (os error 8)

To test this, you can create a bacon.toml with jobs.run.command = ["/not/here"] and execute bacon run.

Before, bacon showed no output at all if spawning failed. Now, it gives a useful error instead:
```
Error: error in computation for job 'run'

Caused by:
    0: failed to spawn cd "../example" && CARGO_TERM_COLOR="always" RUST_BACKTRACE="0" "./run.sh"
    1: Exec format error (os error 8)
```

To test this, you can create a bacon.toml with `jobs.run.command = ["/not/here"]` and execute `bacon run`.
If a command fails, we failed to parse it. So our normal heuristic about
whether to hide or show lines aren't applicable, and we should just
always show it.
@Canop
Copy link
Owner

Canop commented Dec 25, 2024

This is indeed much better.
Are you going to add anything to the PR or is it ready?

@jyn514
Copy link
Contributor Author

jyn514 commented Dec 25, 2024

it's ready, if i make more changes i'll add them in followups.

i noticed that the "run" output is often hidden if the command succeeds, because it doesn't trigger the case in my second commit and it doesn't look like cargo output. but if i change that i'll fix that in a followup, not here.

@Canop Canop merged commit 1314eb5 into Canop:main Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants