https://github.com/holepunchto/libtt JavaScript bindings for Node.js.
npm install tt-native
const { spawn } = require('tt-native')
const pty = spawn('node', ['script.js'])
Spawn a process attached to a pseudo TTY. The returned PTY is a duplex stream.
Options include:
{
width: 80,
height: 60,
env: process.env,
cwd: process.cwd()
}
The current width of the PTY.
The current height of the PTY.
The process ID of the spawned process.
Emitted when the process exit.
Resize the PTY.
Kill the process with the specified signal, which defaults to SIGINT
. The following signals may be used:
SIGINT
SIGKILL
SIGTERM
ISC