Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

See output of external commands like --omx or --on-listening #222

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ if (argv._.length > 1) {

var noop = function () {}

var spawn = function (commandString) {
var parts = commandString.split(/\s+/g)
proc.spawn(parts[0], parts.slice(1), { stdio: 'inherit' })
}

var ontorrent = function (torrent) {
if (argv['peer-port']) argv.peerPort = Number(argv['peer-port'])

Expand Down Expand Up @@ -174,7 +179,7 @@ var ontorrent = function (torrent) {
if (argv['on-downloaded']) {
var downloaded = false
engine.on('uninterested', function () {
if (!downloaded) proc.exec(argv['on-downloaded'])
if (!downloaded) spawn(argv['on-downloaded'])
downloaded = true
})
}
Expand Down Expand Up @@ -264,7 +269,7 @@ var ontorrent = function (torrent) {

if (argv.omx) {
player = 'omx'
proc.exec(OMX_EXEC + ' ' + localHref)
spawn(OMX_EXEC + ' ' + localHref)
}
if (argv.mplayer) {
player = 'mplayer'
Expand All @@ -290,7 +295,7 @@ var ontorrent = function (torrent) {
browser.start()
}

if (argv['on-listening']) proc.exec(argv['on-listening'] + ' ' + href)
if (argv['on-listening']) spawn(argv['on-listening'] + ' ' + href)

if (argv.quiet) return console.log('server is listening on ' + href)

Expand Down