I have to run some interactive shell command inside node.js. Lets our interactive shell be $ python:
$ python
var cp = require(\'child_process\'); var py
This works great for me:
const { spawn } = require('child_process') const shell = spawn('sh',[], { stdio: 'inherit' }) shell.on('close',(code)=>{console.log('[shell] terminated :',code)})