[Patchew-devel] [PATCH] testing: do not pass /dev/null stdin to script(1)

Paolo Bonzini posted 1 patch 5 years, 3 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/patchew next tags/patchew/20190113140430.14156-1-pbonzini@redhat.com
patchew-cli | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[Patchew-devel] [PATCH] testing: do not pass /dev/null stdin to script(1)
Posted by Paolo Bonzini 5 years, 3 months ago
The script tool exits immediately if it encounters an EOF on stdin.
Therefore, we must pass a pipe or the testers' cron jobs will exit
immediately and incorrectly.

The script is still run with /dev/null as stdin, to avoid hangs
on input.

Fixes: eaad26f749f349e182fc360e707ab4deb74f62bd
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 patchew-cli | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/patchew-cli b/patchew-cli
index 6a78f81..8012955 100755
--- a/patchew-cli
+++ b/patchew-cli
@@ -539,8 +539,8 @@ class TesterCommand(SubCommand):
             logf.write("=== OUTPUT BEGIN ===\n")
             logf.flush()
             start_time = time.time()
-            tp = subprocess.Popen(["/usr/bin/script", "-qefc", test_script, "/dev/null"],
-                                  cwd=clone, stdout=logf, stderr=logf)
+            tp = subprocess.Popen(["/usr/bin/script", "-qefc", test_script + "< /dev/null", "/dev/null"],
+                                  cwd=clone, stdin=subprocess.PIPE, stdout=logf, stderr=logf)
             rc = None
             timeout = r["test"]["timeout"]
             while timeout <= 0 or time.time() - start_time < timeout:
-- 
2.20.1

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel