Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorfisch0920 <fisch0920@gmail.com>2014-05-16 13:15:02 +0400
committerfisch0920 <fisch0920@gmail.com>2014-05-16 13:15:02 +0400
commita1afa10e49f95293cb2b36d89f67af6f5f4446ad (patch)
tree9d52b1135aff7ef7d9ee19ed7014c93b360bd98e /bin
parent976fd11e8a4653d6806ee5c67025765c87dfdb83 (diff)
.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/cmd.js23
1 files changed, 14 insertions, 9 deletions
diff --git a/bin/cmd.js b/bin/cmd.js
index 4f00c58..7117150 100755
--- a/bin/cmd.js
+++ b/bin/cmd.js
@@ -52,6 +52,7 @@ var subtitles = argv.subtitles || argv.t
var quiet = argv.quiet || argv.q
var noquit = argv.n || argv['no-quit']
var blocklist = argv.blocklist || argv.b
+var removeOnExit = argv.remove || argv.r
if (argv.help || argv.h) {
usage()
@@ -106,21 +107,21 @@ client.server.once('listening', function () {
listening = true
})
-if (argv.remove || argv.r) {
- function remove () {
- client.destroy(function () {
- process.nextTick(function () {
- process.exit()
- })
+function remove () {
+ client.destroy(function () {
+ process.nextTick(function () {
+ process.exit()
})
- }
+ })
+}
+if (removeOnExit) {
process.on('SIGINT', remove)
process.on('SIGTERM', remove)
}
client.add(torrentId, {
- remove: argv.remove || argv.r
+ remove: removeOnExit
}, function (err, torrent) {
if (err) {
clivas.line('{red:error} ' + err.message)
@@ -261,7 +262,11 @@ function ontorrent (torrent) {
if (!quiet) {
clivas.line('torrent downloaded {green:successfully} from {bold:'+wires.length+'} {green:peers} in {bold:'+getRuntime()+'s}!')
}
- process.exit(0)
+ if (removeOnExit) {
+ remove()
+ } else {
+ process.exit(0)
+ }
})
}