distrobox icon indicating copy to clipboard operation
distrobox copied to clipboard

[Suggestion] Return error when command run with `distrobox-host-exec` fails

Open AlbertoFabbri93 opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. distrobox-host-exec does not return the error if a program call fails.

Describe the solution you'd like I would like distrobox-host-exec to behave as when the command is run directly on the host.

Additional context Wrong command run on the host:

(bash) albi@localhost:~ 
$ micro
exit <-----

Wrong command run from a container with distrobox-host-exec:

(bash) albi@abox:~ 
$ distrobox-host-exec micro
     <-------

AlbertoFabbri93 avatar Feb 11 '24 16:02 AlbertoFabbri93

It currently correctly returns the right exit code: image

89luca89 avatar Feb 18 '24 10:02 89luca89

You are right, the error codes are correctly returned. What I wanted was for bash to print exit when a command fails with distrobox-exec-host as it does on the host system:

Screenshot from 2024-02-20 14-00-29

But as it can be seen from the screenshot this happens not only with distrobox-host-exec but for all commands run inside distrobox so the "problem" should be somewhere else.

Furthermore I found a post on Stack Exchange where they explain why exit is printed in the first place but I am still not getting the logic fully:

Bash prints "exit" when it is about to exit a non-login shell, and prints "logout" (or equivalent in a locale used) when it is about to exit a login shell.

Summary: I am closing this as it is really not a big deal and I need to study a bit more how things work. Thank you very much for your answer and time!

AlbertoFabbri93 avatar Feb 20 '24 13:02 AlbertoFabbri93