Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/dfx/src/lib/builders/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,12 @@ fn run_command(
}
}

let output = cmd.output().expect("Could not run custom tool.");
let output = cmd.output().unwrap_or_else(|_| {
panic!(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unwrap_or_else() means to return a value, but in this case it doesn't so you can use expect.

In any case, we normally return error types that result into error messages. We try to avoid panic here because there could be other custom tools and we want to surface all errors.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Hans. I actually closed https://dfinity.atlassian.net/browse/SDK-791 because the command line was there --- not in the error message, but directly above. See Jira. Since
(a) the info is already there
(b) the debug string form std::process::Cmd is actually not very nice

I think it's fine the way it is, which is why I closed the ticket.

"Could not run custom tool. The failing command was:\n\t{:?}",
cmd
)
});
if output.status.success() {
Ok(())
} else {
Expand Down