mathworks / MATLAB-extension-for-vscode

This extension provides support for editing MATLAB® code in Visual Studio® Code and includes features such as syntax highlighting, code analysis, navigation support, and more.
https://marketplace.visualstudio.com/items?itemName=MathWorks.language-matlab
MIT License
234 stars 15 forks source link

Code Execution Fails to Stop with CTRL+C or Terminal Kill When Printing to Terminal #175

Open Ayham-AlAkhras opened 4 weeks ago

Ayham-AlAkhras commented 4 weeks ago

Describe the bug
The execution of code does not stop when using the CTRL+C shortcut or by killing the MATLAB terminal when something is being printed to the terminal.

Steps to reproduce:

  1. Create an infinite loop: while true; disp(1); end
  2. Press CTRL+C to stop the process.
  3. Kill the terminal by clicking the trashcan icon at the top of the integrated terminal window.

Expected behavior
Code execution should halt with the CTRL+C shortcut, and if that fails, it should stop when the terminal is terminated.

Useful information:

Additional context
This behavior seems unusual. Killing the terminal does not terminate the process. For example, with an infinite loop (while true end), closing the MATLAB terminal does not stop the execution. When opening a new MATLAB terminal, the code continues to run and can only be stopped with CTRL+C. However, in cases where output is being printed to the terminal (as described), neither CTRL+C nor killing the terminal works, and reopening the terminal becomes impossible. The only way to stop the process is to terminate the entire VSCode instance via Task Manager.

philipb314 commented 3 weeks ago

Thank you for reporting this issue. This is something I can reproduce and is something that we will be working on resolving in a coming release.