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

error when exiting a cub #39

Closed
superfell opened this issue Sep 28, 2022 · 2 comments · Fixed by #50
Closed

error when exiting a cub #39

superfell opened this issue Sep 28, 2022 · 2 comments · Fixed by #50

Comments

@superfell
Copy link

This is using #38 on arm/osx
I cub enter bob3 do some things, then use exit to leave bob3. At which point i get an error

simon@bob3:~/w$ exit
Error: failed to run command in environment "bob3"

Caused by:
    Non-zero exit status (1) from docker exec

Stack backtrace:
   0: anyhow::backtrace::capture::Backtrace::capture
   1: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
   2: cubicle::docker::Docker::run_
   3: <cubicle::runner::CheckedRunner as cubicle::runner::Runner>::run
   4: cub::cli::run
   5: cub::main
   6: std::sys_common::backtrace::__rust_begin_short_backtrace
   7: std::rt::lang_start::{{closure}}
   8: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/ops/function.rs:280:13
      std::panicking::try::do_call
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:492:40
      std::panicking::try
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:456:19
      std::panic::catch_unwind
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panic.rs:137:14
      std::rt::lang_start_internal::{{closure}}
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/rt.rs:128:48
      std::panicking::try::do_call
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:492:40
      std::panicking::try
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:456:19
      std::panic::catch_unwind
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panic.rs:137:14
      std::rt::lang_start_internal
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/rt.rs:128:20
   9: _main
@ongardie
Copy link
Owner

I think probably the last command you ran in bob3 failed, like:

bob3% false
bob3% exit
Error: failed to run command in environment "bob3"

Caused by:
    Non-zero exit status (1) from docker exec
Command exited with status 1 [this is output by Diego's shell prompt]
~$ 

Then the shell will exit with a non-zero status, and it looks to Cubicle like everything failed terribly. I don't know if there's a better way to handle this, other than having Cubicle ignore the exit status of interactive shells.

Docker seems to pass the exit status through but not display an error:

~$ docker run -it --rm debian             
root@1686f5a4afd8:/# false
root@1686f5a4afd8:/# 
exit
Command exited with status 1 [this is output by Diego's shell prompt]
~$ docker run -it --rm debian
root@9965e1ea7990:/# true
root@9965e1ea7990:/# 
exit
~$ 

@superfell
Copy link
Author

Ah, yes, that'd be it.

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

Successfully merging a pull request may close this issue.

2 participants