When running the example snippet from the node-pty documentation under the VS Code debugger, my script freezes on the call to pty.spawn.
const ptyProcess = pty.spawn(shell, [], { name: 'xterm-color', cols: 80, rows: 30, cwd: process.env.HOME, env: process.env });
Through some investigation, it appears this issue is related to the use of conpty. The exact line where the freeze occurs is in windowsPtyAgent.js:
var connect = this._ptyNative.connect(this._pty, commandLine, cwd, env, function (c) { return _this._$onProcessExit(c); });
Interestingly, if a breakpoint is set on this line, the script will continue execution normally after the breakpoint is hit and the program is resumed. The script also runs without any problems when the VS Code debugger is not used.
As a temporary workaround, the freezing issue can be mitigated by disabling conpty when running under debugger by useConpty in the options passed to the pty.spawn function. However, this is not an ideal fix as it prevents the usage of conpty.
useConpty: inspector.url() !== undefined ? false : undefined,
Environment details
Issue description
When running the example snippet from the node-pty documentation under the VS Code debugger, my script freezes on the call to pty.spawn.
const ptyProcess = pty.spawn(shell, [], { name: 'xterm-color', cols: 80, rows: 30, cwd: process.env.HOME, env: process.env });
Through some investigation, it appears this issue is related to the use of conpty. The exact line where the freeze occurs is in windowsPtyAgent.js:
var connect = this._ptyNative.connect(this._pty, commandLine, cwd, env, function (c) { return _this._$onProcessExit(c); });
Interestingly, if a breakpoint is set on this line, the script will continue execution normally after the breakpoint is hit and the program is resumed. The script also runs without any problems when the VS Code debugger is not used.
As a temporary workaround, the freezing issue can be mitigated by disabling conpty when running under debugger by useConpty in the options passed to the pty.spawn function. However, this is not an ideal fix as it prevents the usage of conpty.
useConpty: inspector.url() !== undefined ? false : undefined,