Browse Source

Make Crunchy to properly return a return code when running fine or failing

Godzil 6 years ago
parent
commit
3bf5fea735
3 changed files with 15 additions and 1 deletions
  1. 10 0
      bin/crunchy.sh
  2. 2 1
      package.json
  3. 3 0
      src/cli.ts

+ 10 - 0
bin/crunchy.sh

@@ -0,0 +1,10 @@
+#!/bin/bash
+PARAMS=$*
+for i in {1..20}; do
+	crunchy -u ${PARAMS}
+	if [ $? == 0 ]; then
+	 	break
+	fi
+	echo "Going to retry..."	
+	sleep 3
+done

+ 2 - 1
package.json

@@ -17,7 +17,8 @@
   },
   "version": "1.2.0",
   "bin": {
-    "crunchy": "./bin/crunchy"
+    "crunchy": "./bin/crunchy",
+    "crunchy.sh": "./bin/crunchy.sh"
   },
   "dependencies": {
     "big-integer": "^1.6.27",

+ 3 - 0
src/cli.ts

@@ -6,5 +6,8 @@ batch(process.argv, (err: any) =>
   if (err)
   {
     console.error(err.stack || err);
+    process.exit(-1)
   }
+  console.info("Done!")
+  process.exit(0)
 });