[build-path-prefix-map-spec] 01/01: Work around older versions of nodejs returning different codes

Ximin Luo infinity0 at debian.org
Tue Mar 14 21:54:58 UTC 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository build-path-prefix-map-spec.

commit 73356853b8bf77b0f53c437eacbeec35db6fe2cf
Author: Ximin Luo <infinity0 at debian.org>
Date:   Tue Mar 14 22:54:40 2017 +0100

    Work around older versions of nodejs returning different codes
---
 consume/pecsplit.js | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/consume/pecsplit.js b/consume/pecsplit.js
index d8f2ca7..97da621 100755
--- a/consume/pecsplit.js
+++ b/consume/pecsplit.js
@@ -4,7 +4,7 @@
 
 var unquote = function(x) {
   if (x.search(/%[^#+.]|%$/) >= 0)
-    throw "invalid value: bad escape: " + x;
+    throw new Error("invalid value: bad escape: " + x);
   return x.replace(/%\./g, ':').replace(/%\+/g, '=').replace(/%#/g, '%');
 };
 
@@ -12,7 +12,7 @@ var parse_prefix_map = function(x) {
   return (x || "").split(/:/g).filter(Boolean).map(function(part) {
     var tuples = part.split(/=/g).map(unquote);
     if (tuples.length !== 2)
-      throw "invalid value: not a pair: " + tuples;
+      throw new Error("invalid value: not a pair: " + tuples);
     return tuples;
   });
 };
@@ -32,8 +32,13 @@ var map_prefix = function(string, pm) {
 
 // Main program
 
-var pm = parse_prefix_map(process.env["BUILD_PATH_PREFIX_MAP"]);
-// var i = 2 is just how nodejs yolos its way through common conventions
-for (var i = 2, l = process.argv.length; i < l; ++i) {
-  console.log(map_prefix(process.argv[i], pm));
+try {
+  var pm = parse_prefix_map(process.env["BUILD_PATH_PREFIX_MAP"]);
+  // var i = 2 is just how nodejs yolos its way through common conventions
+  for (var i = 2, l = process.argv.length; i < l; ++i) {
+    console.log(map_prefix(process.argv[i], pm));
+  }
+} catch (e) {
+  console.error(e.stack);
+  process.exit(1); // older versions returned 8, messing up our CI testing
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/build-path-prefix-map-spec.git



More information about the Reproducible-commits mailing list