Skip to content

Commit 85d306e

Browse files
committed
uses new binary with logfile
1 parent e98919c commit 85d306e

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

lib/browserstack/local.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def initialize(key = nil, binary_path = nil)
1313
else
1414
binary_path
1515
end
16+
@logfile = File.join(Dir.pwd, "local.log")
1617
end
1718

1819
def add_args(key, value=nil)
@@ -43,6 +44,8 @@ def add_args(key, value=nil)
4344
@proxy_pass = "-proxyPass '#{value}'"
4445
elsif key == "hosts"
4546
@hosts = value
47+
elsif key == "logfile"
48+
@logfile = value
4649
end
4750
end
4851

@@ -51,8 +54,9 @@ def start(options = {})
5154
self.add_args(key, value)
5255
end
5356

57+
system("echo '' > '#{@logfile}'")
5458
@process = IO.popen(command, "w+")
55-
@stdout = @process # File.open("local.log", "r")
59+
@stdout = File.open(@logfile, "r")
5660

5761
while true
5862
begin
@@ -63,14 +67,14 @@ def start(options = {})
6367
end
6468
break if line.nil?
6569
if line.match(/\*\*\* Error\:/)
66-
#@stdout.close
70+
@stdout.close
6771
raise BrowserStack::LocalException.new(line)
6872
return
6973
end
7074
if line.strip == "Press Ctrl-C to exit"
7175
@pid = @process.pid
72-
#@stdout.close
73-
return
76+
@stdout.close
77+
break
7478
end
7579
end
7680

@@ -81,7 +85,7 @@ def start(options = {})
8185
end
8286

8387
def isRunning
84-
resp = Net::HTTP.get(URI.parse("http://bs-local.com:45690/check")) rescue nil
88+
resp = Net::HTTP.get(URI.parse("http://bs-local.com:45691/check")) rescue nil
8589
resp && !resp.match(/running/i).nil?
8690
end
8791

@@ -96,7 +100,7 @@ def stop
96100
end
97101

98102
def command
99-
"#{@binary_path} #{@folder_flag} #{@key} #{@folder_path} #{@force_local_flag} #{@local_identifier_flag} #{@only_flag} #{@only_automate_flag} #{@proxy_host} #{@proxy_port} #{@proxy_user} #{@proxy_pass} #{@force_flag} #{@verbose_flag} #{@hosts}".strip
103+
"#{@binary_path} -logFile '#{@logfile}' #{@folder_flag} #{@key} #{@folder_path} #{@force_local_flag} #{@local_identifier_flag} #{@only_flag} #{@only_automate_flag} #{@proxy_host} #{@proxy_port} #{@proxy_user} #{@proxy_pass} #{@force_flag} #{@verbose_flag} #{@hosts}".strip
100104
end
101105
end
102106

lib/browserstack/localbinary.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def initialize
2424
end
2525

2626
@ordered_paths = [
27-
File.expand_path('~'), '.browserstack',
27+
File.join(File.expand_path('~'), '.browserstack'),
2828
Dir.pwd,
2929
Dir.tmpdir
3030
]

0 commit comments

Comments
 (0)