Theia: Warn before closing a terminal

Created on 16 Apr 2020  路  5Comments  路  Source: eclipse-theia/theia

Description

Show a warning if user attempts to close a terminal which has running processes in it.

Reproduction Steps

  1. Run a command (e.g. top) in Theia terminal and any other one.
  2. Close both terminals

OS and Theia version:
OS: Ubuntu 19.10
Theia: master

Diagnostics:

enhancement help wanted terminal

Most helpful comment

We should check though it does not break VS Code extensions. If they can close terminal programmatically then there should not be such dialogs. Maybe also make it configurable via preferences.

All 5 comments

I am not sure whether it is possible. Terminals are stream based, we don't really know what a user is doing. We could have something like that for tasks.

cc @elaihau @RomanNikitenko @marechal-p ?

I think a new internal method was added to test if a shell has a subprocesses running (meaning the shell is in use). See https://github.com/eclipse-theia/theia/blob/master/packages/terminal/src/node/shell-terminal-server.ts#L66-L88

I think a new internal method was added to test if a shell has a subprocess running (meaning the shell is in use). See https://github.com/eclipse-theia/theia/blob/master/packages/terminal/src/node/shell-terminal-server.ts#L66-L88

+1

We should check though it does not break VS Code extensions. If they can close terminal programmatically then there should not be such dialogs. Maybe also make it configurable via preferences.

@akosyakov right, it should work only when clicking X button manually, not by commands. Preference should be added as well, but its default must prevent closing.

Was this page helpful?
0 / 5 - 0 ratings