Skip to content

Commit 0205de5

Browse files
committed
Windows Changes
1 parent 538ea00 commit 0205de5

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

.eslintrc.json

-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
2,
99
"single"
1010
],
11-
"linebreak-style": [
12-
2,
13-
"unix"
14-
],
1511
"semi": [
1612
2,
1713
"always"

lib/Local.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function Local(){
1212
this.logfile = path.join(process.cwd(), 'local.log');
1313
this.exitCallback;
1414

15-
this.errorRegex = /\*\*\* Error: [^\n]+/i;
15+
this.errorRegex = /\*\*\* Error: [^\r\n]*/i;
1616
this.doneRegex = /Press Ctrl-C to exit/i;
1717

1818
this.start = function(options, callback){
@@ -46,7 +46,6 @@ function Local(){
4646
bytesRead += bytes;
4747

4848
var data = buffRead.toString();
49-
//console.log(data);
5049

5150
if(data.match(that.errorRegex)){
5251
fs.closeSync(that.stdout);

lib/LocalBinary.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ function LocalBinary(){
1010

1111
if(this.hostOS.match(/darwin|mac os/i)){
1212
this.httpPath = 'https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal-darwin-x64';
13-
} else if(this.hostOS.match(/mswin|msys|mingw|cygwin|bccwin|wince|emc/i)) {
13+
} else if(this.hostOS.match(/mswin|msys|mingw|cygwin|bccwin|wince|emc|win32/i)) {
1414
this.windows = true;
15-
this.httpPath = 'https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal-win32.exe';
15+
this.httpPath = 'https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal.exe';
1616
} else {
1717
if(this.is64bits)
1818
this.httpPath = 'https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal-linux-x64';
@@ -24,7 +24,8 @@ function LocalBinary(){
2424
if(!this.checkPath(destParentDir))
2525
fs.mkdirSync(destParentDir);
2626

27-
var binaryPath = path.join(destParentDir, 'BrowserStackLocal');
27+
var destBinaryName = (this.windows) ? 'BrowserStackLocal.exe' : 'BrowserStackLocal';
28+
var binaryPath = path.join(destParentDir, destBinaryName);
2829
var file = fs.createWriteStream(binaryPath);
2930

3031
https.get(this.httpPath, function (response) {
@@ -39,7 +40,8 @@ function LocalBinary(){
3940

4041
this.binaryPath = function(callback){
4142
var destParentDir = this.getAvailableDirs();
42-
var binaryPath = path.join(destParentDir, 'BrowserStackLocal');
43+
var destBinaryName = (this.windows) ? 'BrowserStackLocal.exe' : 'BrowserStackLocal';
44+
var binaryPath = path.join(destParentDir, destBinaryName);
4345
if(this.checkPath(binaryPath, fs.X_OK)){
4446
callback(binaryPath);
4547
} else {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "index.js",
66
"scripts": {
77
"pretest": "./node_modules/.bin/eslint lib/* index.js",
8-
"test": "NODE_ENV=testing ./node_modules/.bin/mocha"
8+
"test": "./node_modules/.bin/mocha"
99
},
1010
"keywords": [
1111
"BrowserStack",

test/local.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('Local', function () {
3030
bsLocal.start({ key: process.env.BROWSERSTACK_ACCESS_KEY }, function(){
3131
bsLocal_2 = new browserstack.Local();
3232
try{
33-
bsLocal_2.start({ key: process.env.BROWSERSTACK_ACCESS_KEY }, function(){});
33+
bsLocal_2.start({ key: process.env.BROWSERSTACK_ACCESS_KEY, logfile: "C:\\Users\\Admin\\Desktop\\local.log" }, function(){});
3434
}
3535
catch(err){
3636
expect(err.toString().trim()).to.equal('LocalError: *** Error: Either another browserstack local client is running on your machine or some server is listening on port 45691');

0 commit comments

Comments
 (0)