This repository has been archived by the owner. It is now read-only.

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

Open
mdlawson opened this Issue Jun 5, 2013 · 0 comments

Comments

Projects
None yet
1 participant

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.