[ostree] test-sysroot: Use GSystem to spawn subprocess
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] test-sysroot: Use GSystem to spawn subprocess
- Date: Wed, 19 Mar 2014 13:16:35 +0000 (UTC)
commit a10ddca1da7193cb48520776917b9c35c3880a96
Author: Colin Walters <walters verbum org>
Date: Wed Mar 19 09:13:28 2014 -0400
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 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/tests/test-sysroot.js b/tests/test-sysroot.js
index cfc45db..671eaac 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');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]