mathworks / mathworks/MATLAB-extension-for-vscode

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

Open
#175 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
435
Forks
40
PR merge metrics
No merged PRs in 30d

Description

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:

  • MATLAB Version: 23.2.0.2599560 (R2023b) Update 8
  • VSCode Version: 1.93.0 (user setup)
    • Commit: 4849ca9bdf9666755eb463db297b69e5385090e3
    • Date: 2024-09-04
    • Electron: 30.4.0
    • Chromium: 124.0.6367.243
    • Node.js: 20.15.1
    • OS: Windows_NT x64 10.0.22631

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the infinite-loop case in the MATLAB terminal using the reported CTRL+C and terminal-kill steps on Windows. Trace the extension's terminal and process-lifecycle entry points, then verify that both interruption methods stop execution and that a new MATLAB terminal can be opened afterward.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.