Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bin: Fix exit code propagation #50

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/jasmine-runner.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/* global jasmineImporter */

import GLib from 'gi://GLib';
import System from 'system';

const pkgdatadir = GLib.getenv('TEST_PKGDATADIR') ?? '@pkgdatadir@';
const jasmineMod = GLib.getenv('TEST_JASMINE_MOD') ?? '@jasmine_mod@';
Expand Down Expand Up @@ -30,5 +31,4 @@ const JasmineBoot = await import(`${base}/jasmineBoot.js`);
const _jasmine = new JasmineBoot.Jasmine();
_jasmine.installAPI(globalThis);

// Don't put any code after this; the return value is used as the exit code.
await Command.run(_jasmine, ARGV, 10);
System.exit(await Command.run(_jasmine, ARGV, 10));
12 changes: 5 additions & 7 deletions bin/jasmine.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env -S gjs -m

import GLib from 'gi://GLib';
import * as System from 'system';
import System from 'system';

const pkglibexecdir = GLib.getenv('TEST_PKGLIBEXECDIR') ?? '@pkglibexecdir@';
const pkgdatadir = GLib.getenv('TEST_PKGDATADIR') ?? '@pkgdatadir@';
Expand Down Expand Up @@ -29,9 +29,7 @@ args = Config.wrapArgs(args, config, options);
const process = launcher.spawnv(args);
process.wait(null);

// Don't put any code after this; the return value is used as the exit code.
(function () {
if (process.get_if_exited())
return process.get_exit_status();
return 1;
})();
if (process.get_if_exited())
System.exit(process.get_exit_status());

System.exit(1);