From 62baabc31e86faca0cb554816a83ad38996272f7 Mon Sep 17 00:00:00 2001 From: John Jackson <39013067+johnjhacking@users.noreply.github.com> Date: Mon, 7 Jun 2021 13:52:20 -0600 Subject: [PATCH 1/2] Change call function to Popen The call function can deadlock if the child process prints larger output. Use Popen with the communicate() method with you need pipes. If you switch to Popen, you'll get cleaner debugging. --- fetch-macOS.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fetch-macOS.py b/fetch-macOS.py index f4d7e36..b540db9 100755 --- a/fetch-macOS.py +++ b/fetch-macOS.py @@ -87,8 +87,8 @@ class ReplicationError(Exception): def cmd_exists(cmd): - return subprocess.call("type " + cmd, shell=True, - stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0 + proc subprocess.Popen("type " + cmd, shell=True, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) def replicate_url(full_url, From 0d70bed2edb492587973f62f86bda934f1db3831 Mon Sep 17 00:00:00 2001 From: sickcodes <65906298+sickcodes@users.noreply.github.com> Date: Thu, 1 Jul 2021 08:33:40 +0000 Subject: [PATCH 2/2] Update fetch-macOS.py --- fetch-macOS.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fetch-macOS.py b/fetch-macOS.py index b540db9..c8d9a57 100755 --- a/fetch-macOS.py +++ b/fetch-macOS.py @@ -87,7 +87,7 @@ class ReplicationError(Exception): def cmd_exists(cmd): - proc subprocess.Popen("type " + cmd, shell=True, + return subprocess.Popen("type " + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)