From c26b6713deec4eeeb128c5f7c225c60914407ce0 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Tue, 5 Apr 2016 22:21:22 -0700 Subject: [PATCH] Ignore OS X -psn_xxxx command line argument Fix #214 --- main/index.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/main/index.js b/main/index.js index 26fe7f7c..4628cbb0 100644 --- a/main/index.js +++ b/main/index.js @@ -114,19 +114,18 @@ function sliceArgv (argv) { } function processArgv (argv) { - argv.forEach(function (argvi) { - switch (argvi) { - case '-n': - windows.main.send('dispatch', 'showCreateTorrent') - break - case '-o': - windows.main.send('dispatch', 'showOpenTorrentFile') - break - case '-u': - windows.main.send('showOpenTorrentAddress') - break - default: - windows.main.send('dispatch', 'onOpen', argvi) + argv.forEach(function (arg) { + if (arg === '-n') { + windows.main.send('dispatch', 'showCreateTorrent') + } else if (arg === '-o') { + windows.main.send('dispatch', 'showOpenTorrentFile') + } else if (arg === '-u') { + windows.main.send('showOpenTorrentAddress') + } else if (arg.startsWith('-psn')) { + // Ignore OS X launchd "process serial number" argument + // More: https://github.com/feross/webtorrent-desktop/issues/214 + } else { + windows.main.send('dispatch', 'onOpen', arg) } }) }