eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
19.92k stars 2.49k forks source link

TerminalWidget prints Error for quickly finished Tasks #9350

Open tsmaeder opened 3 years ago

tsmaeder commented 3 years ago

Bug Description:

When creating a shell task with a command that is finished very quickly (I did dir on Windows), the TerminalWidget prints an error message to the log:

root ERROR Request getCwdURI failed with error: terminal "4" does not exist Error: terminal "4" does not exist
    at ShellTerminalServer.<anonymous> (C:\Users\thomas\code\chedev\theia\packages\terminal\lib\node\base-terminal-server.js:158:27)
    at step (C:\Users\thomas\code\chedev\theia\packages\terminal\lib\node\base-terminal-server.js:60:23)
    at Object.next (C:\Users\thomas\code\chedev\theia\packages\terminal\lib\node\base-terminal-server.js:41:53)
    at C:\Users\thomas\code\chedev\theia\packages\terminal\lib\node\base-terminal-server.js:35:71
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\thomas\code\chedev\theia\packages\terminal\lib\node\base-terminal-server.js:31:12)
    at ShellTerminalServer.BaseTerminalServer.getCwdURI (C:\Users\thomas\code\chedev\theia\packages\terminal\lib\node\base-terminal-server.js:153:16)
    at JsonRpcProxyFactory.<anonymous> (C:\Users\thomas\code\chedev\theia\packages\core\lib\common\messaging\proxy-factory.js:213:73)
    at step (C:\Users\thomas\code\chedev\theia\packages\core\lib\common\messaging\proxy-factory.js:48:23)
    at Object.next (C:\Users\thomas\code\chedev\theia\packages\core\lib\common\messaging\proxy-factory.js:29:53)

Debugging through the scenario, I found that there is no real problem happening: it's just the process gets unregistered from the ProcessManager when it ends and the above request happens afterwards. The exception does not seem to have any negative effects on system behavior. I can see the stdout output from the process correctly.

Steps to Reproduce:

  1. Add a 'shell' task to tasks.json just doing dir
  2. Execute it
  3. Observe the exception in the back end log

Additional Information

RomanNikitenko commented 3 years ago

There is an issue https://github.com/eclipse-theia/theia/issues/2961 Maybe they both have the same cause.