From 7a3c78621514fcd643b967c6f78a554eec0ee72f Mon Sep 17 00:00:00 2001 From: "nath@home" Date: Sat, 22 Apr 2017 15:01:31 +0200 Subject: [PATCH 1/3] command-output: Wire subproc stdin to /dev/null This should fix 2488, where beet convert would prevent further inputs. --- beets/util/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/beets/util/__init__.py b/beets/util/__init__.py index f6cd488d6..5db205c02 100644 --- a/beets/util/__init__.py +++ b/beets/util/__init__.py @@ -801,6 +801,7 @@ def command_output(cmd, shell=False): cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, + stdin=subprocess.DEVNULL, close_fds=platform.system() != 'Windows', shell=shell ) From 7a08e4a978e0dcc52bb84d92dcf795c761959f48 Mon Sep 17 00:00:00 2001 From: "nath@home" Date: Sat, 22 Apr 2017 15:07:28 +0200 Subject: [PATCH 2/3] Changelog for 2524 --- docs/changelog.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index bae5c1e49..5c0d15e0f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -52,6 +52,11 @@ New features: * :doc:`/plugins/play`: A new ``-y`` or ``--yes`` parameter lets you skip the warning message if you enqueue more items than the warning threshold usually allows. +* Fix a bug where commands which forked subprocesses would sometimes prevent + further inputs. This bug mainly affected :doc:`/plugins/convert`. + Thanks to :user:`jansol`. + :bug:`2488` + :bug:`2524` Fixes: From b38f34b2c06255f1c51e8714c8af6962e297a3c5 Mon Sep 17 00:00:00 2001 From: "nath@home" Date: Sat, 22 Apr 2017 15:52:09 +0200 Subject: [PATCH 3/3] command_output: insure py2/3 compat This should make #2524 pass --- beets/util/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/beets/util/__init__.py b/beets/util/__init__.py index 5db205c02..ee06df0bf 100644 --- a/beets/util/__init__.py +++ b/beets/util/__init__.py @@ -797,11 +797,16 @@ def command_output(cmd, shell=False): """ cmd = convert_command_args(cmd) + try: # python >= 3.3 + devnull = subprocess.DEVNULL + except AttributeError: + devnull = open(os.devnull, 'r+b') + proc = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - stdin=subprocess.DEVNULL, + stdin=devnull, close_fds=platform.system() != 'Windows', shell=shell )