I want to open a bash shell from nodejs console.
I have tried everything from child_process module, but i did not managed to find a solution where i can see $ prompt.
Thanks
You can make the child inherit the stdio, here you have a working example (Linux) :
const { spawn } = require('child_process')
const shell = spawn('sh',[], { stdio: 'inherit' })
shell.on('close',(code)=>{console.log('[shell] terminated :',code)})
example output :
sh-4.4$ uname
Linux
sh-4.4$ exit
exit
[shell] terminated : 0
Remember to replace sh with the correct shell for your platform requirements