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
1 changed files with 8 additions and 5 deletions

View File

@ -20,6 +20,7 @@
const GLib = imports.gi.GLib; const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio; const Gio = imports.gi.Gio;
const GSystem = imports.gi.GSystem;
const OSTree = imports.gi.OSTree; const OSTree = imports.gi.OSTree;
function assertEquals(a, b) { function assertEquals(a, b) {
@ -35,11 +36,13 @@ function assertNotEquals(a, b) {
function libtestExec(shellCode) { function libtestExec(shellCode) {
let testdatadir = GLib.getenv("TESTDATADIR"); let testdatadir = GLib.getenv("TESTDATADIR");
let libtestPath = GLib.build_filenamev([testdatadir, 'libtest.sh']) let libtestPath = GLib.build_filenamev([testdatadir, 'libtest.sh'])
let cmdline = 'bash -c ' + GLib.shell_quote('. ' + GLib.shell_quote(libtestPath) + '; ' + shellCode); let proc = GSystem.Subprocess.new_simple_argv(['bash', '-c',
print("shellcode=" +cmdline); '. ' + GLib.shell_quote(libtestPath) + '; ' + shellCode],
let [,stdout,stderr,estatus] = GLib.spawn_command_line_sync(cmdline); GSystem.SubprocessStreamDisposition.INHERIT,
print(stderr); GSystem.SubprocessStreamDisposition.INHERIT,
GLib.spawn_check_exit_status(estatus); null);
proc.init(null);
proc.wait_sync_check(null);
} }
libtestExec('setup_os_repository archive-z2 syslinux'); libtestExec('setup_os_repository archive-z2 syslinux');