• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3const child_process = require('child_process');
4
5// Tests that exiting through a catchable signal resets the TTY mode.
6
7const proc = child_process.spawn(process.execPath, [
8  '-e', 'process.stdin.setRawMode(true); console.log("Y"); while(true) {}',
9], { stdio: ['inherit', 'pipe', 'inherit'] });
10
11proc.stdout.on('data', common.mustCall(() => {
12  proc.kill('SIGINT');
13}));
14
15proc.on('exit', common.mustCall(() => {
16  const { stdout } = child_process.spawnSync('stty', {
17    stdio: ['inherit', 'pipe', 'inherit'],
18    encoding: 'utf8',
19  });
20
21  if (stdout.match(/-echo\b/)) {
22    console.log(stdout);
23  }
24}));
25