From 4f5d4db1548585e5662ca2305c4ee254dfd230f8 Mon Sep 17 00:00:00 2001 From: kramsee Date: Sun, 15 Apr 2018 14:21:32 +0200 Subject: [PATCH 1/2] Fix bug in open_command execution I wasn't able to get the open_command working when I wanted to pass a magnet URL to the open_command. With `shell=True` python opens a new shell for the executable. --- pirate/pirate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pirate/pirate.py b/pirate/pirate.py index 1e20007..ecd145c 100755 --- a/pirate/pirate.py +++ b/pirate/pirate.py @@ -417,7 +417,7 @@ def pirate_main(args): elif args.output == 'open_command': cmd = parse_cmd(args.open_command, url) printer.print(" ".join(cmd)) - subprocess.call(cmd) + subprocess.call(cmd, shell=True) elif args.output == 'browser_open': webbrowser.open(url) From e6d46336b0ec6f7d621c1ba50293c226bcd17add Mon Sep 17 00:00:00 2001 From: kramsee Date: Sun, 15 Apr 2018 14:27:04 +0200 Subject: [PATCH 2/2] Update test for changed open_command call --- tests/test_pirate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_pirate.py b/tests/test_pirate.py index 7ccbb03..ab41fd0 100755 --- a/tests/test_pirate.py +++ b/tests/test_pirate.py @@ -38,7 +38,7 @@ class TestPirate(unittest.TestCase): config = pirate.pirate.parse_config_file('') args = pirate.pirate.combine_configs(config, pirate.pirate.parse_args(['-0', 'term', '-C', 'blah %s'])) pirate.pirate.pirate_main(args) - mock_call.assert_called_once_with(['blah', 'dn=derp']) + mock_call.assert_called_once_with(['blah', 'dn=derp'], shell=True) @patch('pirate.pirate.builtins.input', return_value='0') @patch('subprocess.call') @@ -54,7 +54,7 @@ class TestPirate(unittest.TestCase): config = pirate.pirate.parse_config_file('') args = pirate.pirate.combine_configs(config, pirate.pirate.parse_args(['term', '-C', 'blah %s'])) pirate.pirate.pirate_main(args) - mock_call.assert_called_once_with(['blah', 'dn=derp']) + mock_call.assert_called_once_with(['blah', 'dn=derp'], shell=True) def test_parse_torrent_command(self): tests = [