Execute shell commands and detect cross-platform terminal emulators
npm install opn-shell
Execute shell commands and detect cross-platform terminal emulators
opn-shell allows you to execute shell commands in a terminal emulator window that opens either as a tab or a new window (depending on your terminal emulator) configuration.
It will automatically detect the available terminal emulators that exist in your OS and supports both MacOS and Linux, with a fallback to the associated program on Windows.
``bash`
npm install --save opn-shell
Call opn-shell() with a full path to an executable that will be launched in a terminal window.
If the promise returned by opn-shell() rejects then it failed to detect and open a terminal window.
`js
// @TODO
const TerminalLauncher = require('opn-shell')
const executable = '/usr/local/bin/my-shell-program.sh'
TerminalLauncher.launchTerminal({ path: executable }).catch(err => {
console.log(err)
})
`
`shell``
npx opn-shell my-shell-program.sh
Please consult CONTIRBUTING for guidelines on contributing to this project.
opn-shell © Liran Tal, Released under the Apache-2.0 License.