Exit code 1 when exiting an Ubuntu multiplexed pane #9182

Closed
opened 2026-01-31 01:48:04 +00:00 by claunia · 5 comments
Owner

Originally created by @guillaumemeyer on GitHub (Jun 20, 2020).

Environment

OS:
image

Terminal:
image

SubSystem:
image

Steps to reproduce

  1. Open an Ubuntu tab, then open a second multiplexed ubuntu session in a pane
  2. Run some commands in the right pane, such as htop
  3. Go back to the prompt and type exit

Expected behavior

The right pane should close, leaving only the first pane.

Actual behavior

The right pane doesn't close and raises an error code 1:
image

Originally created by @guillaumemeyer on GitHub (Jun 20, 2020). # Environment OS: ![image](https://user-images.githubusercontent.com/1385518/85207307-3061c900-b328-11ea-8ee0-e61c1d213d0b.png) Terminal: ![image](https://user-images.githubusercontent.com/1385518/85207317-3d7eb800-b328-11ea-9255-81fbae484520.png) SubSystem: ![image](https://user-images.githubusercontent.com/1385518/85207342-6f901a00-b328-11ea-9fec-ad3de2551783.png) # Steps to reproduce 1. Open an Ubuntu tab, then open a second multiplexed ubuntu session in a pane 2. Run some commands in the right pane, such as htop 3. Go back to the prompt and type `exit` # Expected behavior The right pane should close, leaving only the first pane. # Actual behavior The right pane doesn't close and raises an error code 1: ![image](https://user-images.githubusercontent.com/1385518/85207282-fdb7d080-b327-11ea-99ac-1aa13bd4b2cd.png)
claunia added the Issue-QuestionNeeds-Tag-FixResolution-Answered labels 2026-01-31 01:48:05 +00:00
Author
Owner

@TrueshotBarrage commented on GitHub (Jun 25, 2020):

I can reproduce the same error using the steps outlined above.

@TrueshotBarrage commented on GitHub (Jun 25, 2020): I can reproduce the same error using the steps outlined above.
Author
Owner

@DHowett commented on GitHub (Jun 26, 2020):

This is interesting. Before you exit, can you run echo $? to show the error code from the previous process?

@DHowett commented on GitHub (Jun 26, 2020): This is interesting. Before you `exit`, can you run `echo $?` to show the error code from the previous process?
Author
Owner

@DHowett commented on GitHub (Jun 26, 2020):

Oh, and, how do you exit htop?

bash reflects the exit code of the last process as its own exit code. That means that when htop exits with code 1, bash says "I HAVE FAILED" and Terminal picks that up. That's by design - Terminal defaults to preserving the window when the process inside it has exited.

To turn off this behavior, set closeOnExit to always. 😄

@DHowett commented on GitHub (Jun 26, 2020): Oh, and, how do you exit `htop`? bash reflects the exit code of the last process _as its own exit code_. That means that when htop exits with code `1`, bash says "I HAVE FAILED" and Terminal picks that up. That's by design - Terminal defaults to preserving the window when the process inside it has exited. To turn off this behavior, set `closeOnExit` to `always`. :smile:
Author
Owner

@guillaumemeyer commented on GitHub (Jun 26, 2020):

I'm exiting htop with ctrl+c, and you're right about the exit code @DHowett :
image

@guillaumemeyer commented on GitHub (Jun 26, 2020): I'm exiting htop with `ctrl+c`, and you're right about the exit code @DHowett : ![image](https://user-images.githubusercontent.com/1385518/85871546-d69d4b00-b7ce-11ea-8739-ec71695ce2ea.png)
Author
Owner

@guillaumemeyer commented on GitHub (Jun 26, 2020):

And yes using "closeOnExit": "always" in the terminal settings solves the issue.

@guillaumemeyer commented on GitHub (Jun 26, 2020): And yes using `"closeOnExit": "always"` in the terminal settings solves the issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9182