Skip to content

Is this output expected? #3

Open

Description

@thbar

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!

Activity

  1. jayjun commented on Jun 17, 2020

    @jayjun
    Owner

    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?

  2. jayjun commented on Jun 17, 2020

    @jayjun
    Owner

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions