事件:'SIGTSTP'
🌐 Event: 'SIGTSTP'
当 input 流接收到 a Ctrl+Z 输入时,会触发 'SIGTSTP' 事件,这通常被称为 SIGTSTP。如果在 input 流接收到 SIGTSTP 时没有注册 'SIGTSTP' 事件监听器,Node.js 进程将会被送到后台运行。
当使用 fg(1p) 恢复程序时,将会触发 'pause' 和 'SIGCONT' 事件。这些事件可以用于恢复 input 流。
🌐 When the program is resumed using fg(1p), the 'pause' and 'SIGCONT' events
will be emitted. These can be used to resume the input stream.
如果在将进程置于后台之前 input 已被暂停,则不会触发 'pause' 和 'SIGCONT' 事件。
🌐 The 'pause' and 'SIGCONT' events will not be emitted if the input was
paused before the process was sent to the background.
调用监听器函数时不传入任何参数。
🌐 The listener function is invoked without passing any arguments.
rl.on('SIGTSTP', () => {
// This will override SIGTSTP and prevent the program from going to the
// background.
console.log('Caught SIGTSTP.');
}); 'SIGTSTP' 事件在 Windows 上不支持。
🌐 The 'SIGTSTP' event is not supported on Windows.