Skip to content

Is this output expected? #3

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

Open
thbar opened this issue Jun 16, 2020 · 2 comments
Open

Is this output expected? #3

thbar opened this issue Jun 16, 2020 · 2 comments

Comments

@thbar
Copy link

thbar commented Jun 16, 2020

I'm trying out Rambo to monitor long-running Ruby processes. Thank you for your work!

If I run something like:

Rambo.run("incorrect_command", log: true)

I will get {:error, "rambo exited with 0"} as the output.

But if I run this from the command line, instead I will get -bash: incorrect_command: command not found.

I found the error message somewhat surprising (even if I understand where it comes from).

Should it instead capture & return the output of bash?

Thanks!

@jayjun
Copy link
Owner

jayjun commented Jun 17, 2020

exited with 0 is definitely surprising to me. I tried and got 101 as expected.

iex(1)> Rambo.run("incorrect_command", log: true)
thread 'main' panicked at 'failed to spawn child: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/main.rs:203:21
                                                                                                                                           note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
                                      {:error, "rambo exited with 101"}

Either way, Rambo does not use Bash or any shell. It forks and executes the command directly, so there’s no command not found generated.

Currently Rambo crashes by design because a wrong command should be a programming error. Would a friendlier message help?

@jayjun
Copy link
Owner

jayjun commented Jun 17, 2020

To clarify, the Rambo shim crashes by design but Rambo inside Elixir still returns gracefully with {:error, "rambo exited with 101"}. So two other options are,

  1. Crash inside Elixir too with Rambo.CommandNotFoundError.
  2. Return with a better error message like {:error, "rambo: command not found"}.

Adding Rambo.run! to support both does not seem right. A wrong command should be fatal and surfaced as soon as possible, so I’m leaning to option 1.

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

2 participants