From b2444feae97274b644395da197f7b191f23cd7bb Mon Sep 17 00:00:00 2001
From: Juan Cruz Viotti <juanchiviotti@gmail.com>
Date: Tue, 3 Mar 2015 11:32:56 -0400
Subject: [PATCH] Make use of process.argv[0] instead of hardcoding "node" to
 windosu

---
 build/actions/os.js   | 2 +-
 lib/actions/os.coffee | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/build/actions/os.js b/build/actions/os.js
index e8ed6559..b5cbc76b 100644
--- a/build/actions/os.js
+++ b/build/actions/os.js
@@ -123,7 +123,7 @@
         if (os.platform() === 'win32' && (error != null) && (error.code === 'EPERM' || error.code === 'EACCES')) {
           windosu = require('windosu');
           resinWritePath = "\"" + (path.join(__dirname, '..', '..', 'bin', 'resin-write')) + "\"";
-          return windosu.exec("node " + resinWritePath + " \"" + params.image + "\" \"" + params.device + "\"");
+          return windosu.exec("\"" + process.argv[0] + "\" " + resinWritePath + " \"" + params.image + "\" \"" + params.device + "\"");
         } else {
           return done(error);
         }
diff --git a/lib/actions/os.coffee b/lib/actions/os.coffee
index 820311af..6d4aafc4 100644
--- a/lib/actions/os.coffee
+++ b/lib/actions/os.coffee
@@ -157,6 +157,6 @@ exports.install =
 
 				# Need to escape every path to avoid errors
 				resinWritePath = "\"#{path.join(__dirname, '..', '..', 'bin', 'resin-write')}\""
-				windosu.exec("node #{resinWritePath} \"#{params.image}\" \"#{params.device}\"")
+				windosu.exec("\"#{process.argv[0]}\" #{resinWritePath} \"#{params.image}\" \"#{params.device}\"")
 			else
 				return done(error)