|
1 | 1 | var exec = require('child_process').exec,
|
2 | 2 | fs = require('fs'),
|
3 | 3 | http = require('http'),
|
4 |
| - localBinary = __dirname + '/BrowserStackLocal', |
| 4 | + windows = (process.platform.match(/win/) != null), |
| 5 | + localBinary = __dirname + (windows ? '/BrowserStackTunnel.jar' : '/BrowserStackLocal'), |
5 | 6 | utils = require('./utils'),
|
6 | 7 | config = require('./config');
|
7 | 8 |
|
8 | 9 | var Tunnel = function Tunnel (key, port, uniqueIdentifier, callback, err) {
|
9 | 10 | var that = {};
|
10 | 11 |
|
11 | 12 | function tunnelLauncher () {
|
12 |
| - var tunnelCommand = localBinary + ' '; |
| 13 | + var tunnelCommand = (windows ? 'java -jar ' : '') + localBinary + ' '; |
13 | 14 | if (config.debug)
|
14 | 15 | tunnelCommand += ' -v ';
|
15 | 16 | tunnelCommand += key + ' ';
|
16 | 17 | tunnelCommand += 'localhost' + ',';
|
17 | 18 | tunnelCommand += port.toString() + ',';
|
18 | 19 | tunnelCommand += '0';
|
19 |
| - tunnelCommand += (typeof uniqueIdentifier === 'undefined')? ' -force -onlyAutomate' : ' -uniqueIdentifier ' + uniqueIdentifier; |
| 20 | + tunnelCommand += (typeof uniqueIdentifier === 'undefined')? ' -force -onlyAutomate' : ' -tunnelIdentifier ' + uniqueIdentifier; |
20 | 21 |
|
21 | 22 | if (typeof callback !== 'function') {
|
22 | 23 | callback = function () {};
|
@@ -70,7 +71,7 @@ var Tunnel = function Tunnel (key, port, uniqueIdentifier, callback, err) {
|
70 | 71 |
|
71 | 72 | var file = fs.createWriteStream(localBinary);
|
72 | 73 | var request = http.get(
|
73 |
| - ("http://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal-" + process.platform + "-" + process.arch), |
| 74 | + (windows ? "http://www.browserstack.com/BrowserStackTunnel.jar" : ("http://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal-" + process.platform + "-" + process.arch)), |
74 | 75 | function(response) {
|
75 | 76 | response.pipe(file);
|
76 | 77 |
|
|
0 commit comments