From a10ddca1da7193cb48520776917b9c35c3880a96 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 19 Mar 2014 09:13:28 -0400 Subject: [PATCH] test-sysroot: Use GSystem to spawn subprocess I was getting a weird hang in the installed tests with the shell as a zombie process, not reaped by the parent, which was just stuck in select() on the output pipes. The thing is we don't actually want to capture stdout/stderr, we just want to inherit. GSystem.Subprocess makes that possible, so let's just use it now that it's a proper installed library. --- tests/test-sysroot.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/test-sysroot.js b/tests/test-sysroot.js index cfc45dbe..671eaac3 100644 --- a/tests/test-sysroot.js +++ b/tests/test-sysroot.js @@ -20,6 +20,7 @@ const GLib = imports.gi.GLib; const Gio = imports.gi.Gio; +const GSystem = imports.gi.GSystem; const OSTree = imports.gi.OSTree; function assertEquals(a, b) { @@ -35,11 +36,13 @@ function assertNotEquals(a, b) { function libtestExec(shellCode) { let testdatadir = GLib.getenv("TESTDATADIR"); let libtestPath = GLib.build_filenamev([testdatadir, 'libtest.sh']) - let cmdline = 'bash -c ' + GLib.shell_quote('. ' + GLib.shell_quote(libtestPath) + '; ' + shellCode); - print("shellcode=" +cmdline); - let [,stdout,stderr,estatus] = GLib.spawn_command_line_sync(cmdline); - print(stderr); - GLib.spawn_check_exit_status(estatus); + let proc = GSystem.Subprocess.new_simple_argv(['bash', '-c', + '. ' + GLib.shell_quote(libtestPath) + '; ' + shellCode], + GSystem.SubprocessStreamDisposition.INHERIT, + GSystem.SubprocessStreamDisposition.INHERIT, + null); + proc.init(null); + proc.wait_sync_check(null); } libtestExec('setup_os_repository archive-z2 syslinux');