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

Closing a Terminal tab doesn't terminate the running process #13346

Open
profbbrown opened this issue Feb 4, 2024 · 2 comments · May be fixed by #14823
Open

Closing a Terminal tab doesn't terminate the running process #13346

profbbrown opened this issue Feb 4, 2024 · 2 comments · May be fixed by #14823
Labels
bug bugs found in the application help wanted issues meant to be picked up, require help terminal issues related to the terminal

Comments

@profbbrown
Copy link

Bug Description:

If I start a long-running process in a Terminal, then close the Terminal, the process continues running the background. In other words, closing the Terminal does not appear to send the SIGHUP or SIGTERM signal to the process.

As far an I can remember, older versions of Theia's terminal (from a couple years ago) terminated the process when the tab was closed.

Steps to Reproduce:

  1. Open two Terminal tabs.
  2. In one them them, start a long-running process, such as the yes command.
  3. In the other tab, use ps -ef or top to see the process running.
  4. Close the Terminal with the long-running process.
  5. Observe that the process is still running somewhere in the background.

Additional Information

  • Operating System: Docker container running Ubuntu 22.04
  • Theia Version: 1.46.0
@tsmaeder tsmaeder added the terminal issues related to the terminal label Feb 8, 2024
@profbbrown
Copy link
Author

I'm not familiar with the Theia codebase, but if this is an easy fix and someone could point me in the right direction, it's something I could try to tackle.

@msujew msujew added bug bugs found in the application help wanted issues meant to be picked up, require help labels Mar 23, 2024
@kittaakos
Copy link
Contributor

I'm not familiar with the Theia codebase, but if this is an easy fix and someone could point me in the right direction, it's something I could try to tackle.

The breaking change is likely related to this: 4694363#diff-da3ea75041150eb2403247c5ed84542210774c326c0e3b334029f4e3afb51fc0R373.

The onCloseRequest method has been overridden in the widget, and an exitStatus is assigned to the terminal to support the exit reason. However, the process termination code in the dispose method will never execute because the exitStatus is always set.

if (this.closeOnDispose === true && typeof this.terminalId === 'number' && !this.exitStatus) {

You can resolve this issue by changing !this.exitStatus to !this.exitStatus?.code.

kittaakos added a commit to kittaakos/theia that referenced this issue Feb 3, 2025
Check `exitStatus.code` instead of checking the falsyness of the
`exitStatus`. The latter is always truthy with the exit reason
support.

Ref: eclipse-theia#12293

Closes: eclipse-theia#13346
@kittaakos kittaakos linked a pull request Feb 3, 2025 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs found in the application help wanted issues meant to be picked up, require help terminal issues related to the terminal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants