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

Request: Show failed nix command #260

Open
tecosaur opened this issue Feb 16, 2024 · 0 comments
Open

Request: Show failed nix command #260

tecosaur opened this issue Feb 16, 2024 · 0 comments
Assignees

Comments

@tecosaur
Copy link

For some reason, my nix daemon has started having "Connection refused issues" during attempted deployments

๐Ÿš€ โ„น๏ธ [deploy] [INFO] Building profile `system` for node `golgi`
๐Ÿš€ โ„น๏ธ [deploy] [INFO] Copying profile `system` to node `golgi`
error: cannot connect to socket at '/nix/var/nix/daemon-socket/socket': Connection refused
error: unexpected end-of-file
๐Ÿš€ โŒ [deploy] [ERROR] Failed to push profile: Nix copy command resulted in a bad exit code: Some(1)

I'm not sure where this issue is coming from, but one thing that might make it easier to track down is if deploy-rs were to print the nix command that failed when it produces a bad exit code.

@Sereja313 Sereja313 self-assigned this Apr 1, 2024
heitor-lassarote added a commit that referenced this issue Jan 8, 2025
Problem: Many errors result from attempts to build commands which might
error with a non-zero exit code. The failed commands are not displayed
to the user, however.

Solution: For every `([A-Za-z])Exit(Option<i32>)` error, change it to
`\1Exit(Option<i32>, String)`, where the `String` contains the failed
command. Format each `tokyo` command using `{:?}` and save it to the
corresponding error.

Note that `Command` cannot be copied or cloned, and it's not possible to
access a command's `std` field to get the underlying command, so we
resort to putting the `Debug`-formatted command.
heitor-lassarote added a commit that referenced this issue Jan 10, 2025
Problem: It's common to spawn a command and occasionally fail during
running the command or because it exited, leading to code repetition.

Solution: Create a `command` module to abstract some of the boilerplate
by wrapping `tokio::process::Command`. Create a `run` function that
abstracts most of this boilerplate.

In some parts, the way commands are executed are a bit different, so
instead we leave them as it is.
heitor-lassarote added a commit that referenced this issue Jan 10, 2025
Problem: The output when a command failed for deployment would show the
error message in the console output and _then_ the error message, which
was confusing.

Solution: Show the error message together with the error in an order
that makes sense. This is done by capturing the output in the error
message and printinting it in an exit error. We also use `Stdio::null`
rather than `Stdio::piped` to avoid printing to the console.
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

No branches or pull requests

3 participants