Open a terminal tab programatically.
npm install terminal-tab -g
const terminalTab = require('terminal-tab')
terminalTab.open(`echo "my command"; sleep 2 && exit`)
Child process command options:
const options = {
cwd: null,
env: null,
encoding: 'utf8'
}
terminalTab.open(`echo "my command"`, options)
terminalTab.open(`echo "my command"`, options, {
onStdout: (stdout) => {},
onStderr: (stderr) => {},
onError: (error) => {},
onExit: (code, signal) => {
console.log('exit:', code, signal)
process.exit(0)
}
})
Alternatively:
terminalTab.open(`echo "my command"`, options, (stdout) => {})
Without options:
terminalTab.open(`echo "my command"`, (stdout) => {})
terminal_tab 'echo hello'
echo 'echo hello' | terminal_tab
MIT