Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit b802a05

Browse files
committed
Invoke local binaries with node on win32
Explicitly calls the local binary wrappers with node on win32 as the shebang line is not used. Resolves issue #21
1 parent 6b8a4be commit b802a05

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

index.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
22

3+
var os = require('os');
4+
35
var fs = require('fs');
46

57
var path = require('path');
@@ -44,24 +46,25 @@ var PluginError = gutil.PluginError;
4446

4547
var File = gutil.File;
4648

47-
function resolve(cmd, callback) {
49+
function resolve(cmd, args, callback) {
4850
var err = 'Failed to find ' + gutil.colors.cyan(cmd) + '. Please ensure it is available on your system.';
4951

5052
resolveBin(purescriptPackage, {executable: cmd}, function(e, bin){
51-
if (!e) callback(null, bin);
53+
if (!e && os.platform() === 'win32') callback(null, 'node', [bin].concat(args))
54+
else if (!e) callback(null, bin, args);
5255
else {
5356
which(cmd, function(e){
5457
if (e) callback(err);
55-
else callback(null, cmd);
58+
else callback(null, cmd, args);
5659
});
5760
}
5861
});
5962
}
6063

6164
function execute(cmd, args, callback) {
62-
resolve(cmd, function(e, bin){
65+
resolve(cmd, args, function(e, bin, args$prime){
6366
if (e) callback(new PluginError(pluginName, e));
64-
else callback(null, child_process.spawn(bin, args));
67+
else callback(null, child_process.spawn(bin, args$prime));
6568
});
6669
}
6770

0 commit comments

Comments
 (0)