Skip to content

Commit 9ea8a6b

Browse files
committed
Windows binary
1 parent 19d51dd commit 9ea8a6b

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

lib/local.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ var Log = require('./logger'),
44
fs = require('fs'),
55
http = require('http'),
66
windows = ((process.platform.match(/win32/) || process.platform.match(/win64/)) !== null),
7-
localBinary = __dirname + (windows ? '/BrowserStackTunnel.jar' : '/BrowserStackLocal'),
7+
localBinary = __dirname + (windows ? '/BrowserStackTunnel.exe' : '/BrowserStackLocal'),
88
utils = require('./utils'),
99
config = require('./config');
1010

1111
var Tunnel = function Tunnel(key, port, uniqueIdentifier, callback, err) {
1212
var that = {};
1313

1414
function tunnelLauncher() {
15-
var tunnelCommand = (windows ? 'java -jar ' : '') + localBinary + ' ';
15+
var tunnelCommand = localBinary + ' ';
1616
if (config.debug) tunnelCommand += ' -v ';
1717
tunnelCommand += key + ' ';
1818
tunnelCommand += 'localhost' + ',';
@@ -63,6 +63,16 @@ var Tunnel = function Tunnel(key, port, uniqueIdentifier, callback, err) {
6363
that.process = subProcess;
6464
}
6565

66+
function getBinaryAddress() {
67+
binaryURL = "http://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal";
68+
if(windows) {
69+
binaryURL += ".exe";
70+
} else {
71+
binaryURL += "-" + process.platform + "-" + process.arch;
72+
}
73+
return binaryURL;
74+
}
75+
6676
function checkAndAddProxy() {
6777
var proxy = config.proxy;
6878
if(typeof proxy == 'undefined') {
@@ -83,14 +93,13 @@ var Tunnel = function Tunnel(key, port, uniqueIdentifier, callback, err) {
8393
tunnelLauncher();
8494
return;
8595
}
86-
logger.debug('Downloading BrowserStack Local to `%s`', localBinary);
96+
logger.debug('Downloading BrowserStack Local to `%s` from `%s`', localBinary, getBinaryAddress());
8797

8898
var file = fs.createWriteStream(localBinary);
8999
var request = http.get(
90-
(windows ? "http://www.browserstack.com/BrowserStackTunnel.jar" : ("http://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal-" + process.platform + "-" + process.arch)),
100+
getBinaryAddress(),
91101
function(response) {
92102
response.pipe(file);
93-
94103
response.on('end', function() {
95104
fs.chmodSync(localBinary, 0700);
96105
setTimeout(function() {
@@ -106,4 +115,4 @@ var Tunnel = function Tunnel(key, port, uniqueIdentifier, callback, err) {
106115
return that;
107116
};
108117

109-
exports.Tunnel = Tunnel;
118+
exports.Tunnel = Tunnel;

0 commit comments

Comments
 (0)