xref: /third_party/node/test/pseudo-tty/test-set-raw-mode-reset-process-exit.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/pseudo-tty/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_cirequire('../common');
31cb0ef41Sopenharmony_ciconst child_process = require('child_process');
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci// Tests that exiting through process.exit() resets the TTY mode.
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_cichild_process.spawnSync(process.execPath, [
81cb0ef41Sopenharmony_ci  '-e', 'process.stdin.setRawMode(true); process.exit(0)',
91cb0ef41Sopenharmony_ci], { stdio: 'inherit' });
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ciconst { stdout } = child_process.spawnSync('stty', {
121cb0ef41Sopenharmony_ci  stdio: ['inherit', 'pipe', 'inherit'],
131cb0ef41Sopenharmony_ci  encoding: 'utf8',
141cb0ef41Sopenharmony_ci});
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ciif (stdout.match(/-echo\b/)) {
171cb0ef41Sopenharmony_ci  console.log(stdout);
181cb0ef41Sopenharmony_ci}
19

Indexes created Thu Nov 07 10:32:03 CST 2024