:wrench: Ensure correct types for commandLine
authorFelix Rieseberg <felix@felixrieseberg.com>
Fri, 16 Sep 2016 18:43:48 +0000 (11:43 -0700)
committerKevin Sawicki <kevinsawicki@gmail.com>
Mon, 19 Sep 2016 16:31:59 +0000 (09:31 -0700)
This commit ensures that arguments passed to `appendSwitch` and `appendArgument` are turned into strings before passing them over to the binding.

lib/browser/api/app.js

index c6ad57321baacf5277cfef75e7f1e5683dacbcc4..a3d227b0796111537f44668c45199253238aafa3 100644 (file)
@@ -24,8 +24,20 @@ Object.assign(app, {
     return Menu.getApplicationMenu()
   },
   commandLine: {
-    appendSwitch: bindings.appendSwitch,
-    appendArgument: bindings.appendArgument
+    appendSwitch() {
+      let castedArgs = [...arguments].map((arg) => {
+        return typeof arg !== 'string' ? `${arg}` : arg
+      })
+
+      return binding.appendSwitch(...castedArgs)
+    },
+    appendArgument() {
+      let castedArgs = [...arguments].map((arg) => {
+        return typeof arg !== 'string' ? `${arg}` : arg
+      })
+
+      return binding.appendArgument(...castedArgs)
+    }
   }
 })