Skip to content

Commit d9015fa

Browse files
committed
Merge pull request #17 from browserstack/jar_issues
change download directory of jar from /tmp
2 parents b5f410a + 688b8b0 commit d9015fa

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

lib/tunnel.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var exec = require('child_process').exec,
22
fs = require('fs'),
33
http = require('http'),
4-
tunnelJar = '/tmp/BrowserStackTunnel.jar',
4+
tunnelJar = __dirname + '/BrowserStackTunnel.jar',
55
utils = require('./utils'),
66
config = require('./config');
77

@@ -24,6 +24,7 @@ var Tunnel = function Tunnel (key, port, tunnelIdentifier, callback, err) {
2424

2525
console.log("Launching tunnel..");
2626
var subProcess = exec(tunnelCommand, function (error, stdout, stderr) {
27+
console.error(stderr);
2728
if (stdout.indexOf('Error') >= 0) {
2829
console.log("..Failed");
2930
console.log(stdout);
@@ -61,22 +62,21 @@ var Tunnel = function Tunnel (key, port, tunnelIdentifier, callback, err) {
6162

6263
fs.exists(tunnelJar, function (exists) {
6364
if (exists) {
64-
tunnelLauncher();
65-
} else {
66-
console.log('Downloading tunnel to `%s`', tunnelJar);
65+
fs.unlinkSync(tunnelJar);
66+
}
67+
console.log('Downloading tunnel to `%s`', tunnelJar);
6768

68-
var file = fs.createWriteStream(tunnelJar);
69-
var request = http.get(
70-
"http://www.browserstack.com/BrowserStackTunnel.jar",
71-
function(response) {
72-
response.pipe(file);
69+
var file = fs.createWriteStream(tunnelJar);
70+
var request = http.get(
71+
"http://www.browserstack.com/BrowserStackTunnel.jar",
72+
function(response) {
73+
response.pipe(file);
7374

74-
response.on('end', function () {
75-
tunnelLauncher();
76-
});
77-
}
78-
);
79-
}
75+
response.on('end', function () {
76+
tunnelLauncher();
77+
});
78+
}
79+
);
8080
});
8181

8282
return that;

0 commit comments

Comments
 (0)