Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Readline: spawning child process with inherit on windows breaks SIGINT handling #5634

Closed
mdlawson opened this issue Jun 5, 2013 · 0 comments
Labels

Comments

@mdlawson
Copy link

mdlawson commented Jun 5, 2013

When spawning a process like so:

child = spawn("ls",[], {stdio: "inherit"})

in windows, while a readline terminal is in use, after the child process has exited, readline no longer catches ctrl-C as SIGINT, ctrl-C simply exits node.

Can be reproduced in nodejs 0.10.10 with the following code

var readline = require("readline");

var spawn = require("child_process").spawn;

rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

rl.on("line", function(line) {
  var child = spawn("cp", [], {
    stdio: "inherit"
  });
  child.on("exit", function() {
    rl.prompt();
  });
});

rl.on('SIGINT', function() {
  console.log("SIGINT");
  rl.prompt();
});

rl.prompt();

After pressing enter once to run cp, ctrl-c no longer functions as expected

@Trott Trott closed this as completed Apr 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants