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.
This commit is contained in:
Colin Walters 2014-03-19 09:13:28 -04:00
parent efd3a75daa
commit a10ddca1da

View File

@ -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');