Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Unable to kill pty process on Windows

Aperta
#437 12 commenti 7 reazioni 1 assegnatario Vedi su GitHub

@deepak1556 ci sta già lavorando.

Dal 19/12/2025.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug help wanted windows

Environment details

  • OS version: Windows 10 2004
  • Node.js version: 14.15.0
  • node-pty version: 0.9.0

Issue description

Using the simple example script below, I am unable to kill the pty process on Windows 10. However, I can successfully kill the pty process on Ubuntu with the same script and identical versions of Node.js and node-pty.

Test Script

Based on https://github.com/microsoft/node-pty/blob/master/examples/killDeepTree/index.js

var os = require('os');
var pty = require('node-pty');

var shell = process.platform === 'win32' ? 'powershell.exe' : 'bash';

var ptyProcess = pty.spawn(shell, [], {
  name: 'xterm-color',
  cols: 80,
  rows: 30,
  cwd: os.homedir(),
  env: process.env
});

ptyProcess.onData((data) => process.stdout.write(data));

ptyProcess.write('ls\r');

setTimeout(() => {
  console.log('Killing pty');
  ptyProcess.kill();
}, 1000);

Output on Windows

The script hangs on the line "Killing pty" and never returns.

PS C:\Users\Timothy\Projects\test\node-pty-test> node index.js
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\Timothy> ls
...

PS C:\Users\Timothy> Killing pty
Output on Ubuntu

The script finishes and returns to a prompt in the original directory.

timothy@timothy-Virtual-Machine:~/Desktop/node-pty-test$ node index.js
ls
timothy@timothy-Virtual-Machine:~$ ls
...
timothy@timothy-Virtual-Machine:~$ Killing pty
timothy@timothy-Virtual-Machine:~/Desktop/node-pty-test$
Lingua principale
TypeScript
Stelle
2k
Fork
337
Merge medio
21h 58m
PR unite (30g)
3

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/node-pty

Tutte le issue di microsoft/node-pty

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.