[gnome-continuous] ostbuild: don't run main.js as a command line script
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous] ostbuild: don't run main.js as a command line script
- Date: Mon, 21 Apr 2014 21:22:24 +0000 (UTC)
commit 08d05312f0cd4d0a4264e692cd05a5b330fe882f
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Mon Sep 2 21:55:07 2013 +0200
ostbuild: don't run main.js as a command line script
Variables defined there otherwise poison the global object
instead of a private module object.
https://bugzilla.gnome.org/show_bug.cgi?id=723697
src/js/main.js | 76 +++++++++++++++++++++++++++---------------------------
src/ostbuild.in | 2 +-
2 files changed, 39 insertions(+), 39 deletions(-)
---
diff --git a/src/js/main.js b/src/js/main.js
index e089d32..4967985 100644
--- a/src/js/main.js
+++ b/src/js/main.js
@@ -50,45 +50,45 @@ function usage(ecode) {
return ecode;
}
-let ecode;
-if (ARGV.length < 1) {
- ecode = usage(1);
-} else if (ARGV[0] == '-h' || ARGV[0] == '--help') {
- ecode = usage(0);
-} else {
- let name = ARGV[0];
- let found = false;
- for (let i = 0; i < BUILTINS.length; i++) {
- if (BUILTINS[i] == name) {
- found = true;
- break;
- }
- }
- if (!found) {
- usage(1);
+function main() {
+ let ecode;
+ if (ARGV.length < 1) {
+ ecode = usage(1);
+ } else if (ARGV[0] == '-h' || ARGV[0] == '--help') {
+ ecode = usage(0);
} else {
- let argv = ARGV.concat();
- argv.shift();
+ let name = ARGV[0];
+ let found = false;
+ for (let i = 0; i < BUILTINS.length; i++) {
+ if (BUILTINS[i] == name) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ usage(1);
+ } else {
+ let argv = ARGV.concat();
+ argv.shift();
- let loop = GLib.MainLoop.new(null, true);
- let cls = getClass(name);
- let instance = new cls;
- let cancellable = null;
- GLib.idle_add(GLib.PRIORITY_DEFAULT,
- function() {
- ecode = 1;
- try {
- instance.main(argv, loop, cancellable);
- ecode = 0;
- } finally {
- loop.quit();
- }
- return false;
- });
- loop.run();
+ let loop = GLib.MainLoop.new(null, true);
+ let cls = getClass(name);
+ let instance = new cls;
+ let cancellable = null;
+ GLib.idle_add(GLib.PRIORITY_DEFAULT,
+ function() {
+ ecode = 1;
+ try {
+ instance.main(argv, loop, cancellable);
+ ecode = 0;
+ } finally {
+ loop.quit();
+ }
+ return false;
+ });
+ loop.run();
+ }
}
-}
-ecode;
-
-
+ return ecode;
+}
diff --git a/src/ostbuild.in b/src/ostbuild.in
index 1686241..eb1d56b 100755
--- a/src/ostbuild.in
+++ b/src/ostbuild.in
@@ -27,4 +27,4 @@ export GIO_USE_VFS=local
export OSTBUILD_DATADIR= pkgdatadir@
export OSTBUILD_LIBDIR= pkglibdir@
-exec $OSTBUILD_GDB gjs -I "${jsdir}" "${jsdir}/main.js" "$@"
+exec $OSTBUILD_GDB gjs -I "${jsdir}" -c "imports.main.main();" "$@"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]