Skip to content

Commit c0a0c60

Browse files
committed
bugfix: remove trailing whitespaces before regex
* shell script had whitespace which failed the regex * not sure where the white space is coming from (we dont log in applescript) * strip! for safety
1 parent 126cff5 commit c0a0c60

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/vagrant_utm/driver/version_4_5.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def read_forwarded_ports(uuid = nil, active_only: false) # rubocop:disable Metri
9090
results = []
9191
command = ["read_forwarded_ports.applescript", @uuid]
9292
info = execute_osa_script(command)
93+
info.strip! # remove leading and trailing whitespaces to match the regex
9394
info.split("\n").each do |line|
9495
# Parse info, Forwarding(nicIndex)(ruleIndex)="Protocol,GuestIP,GuestPort,HostIP,HostPort"
9596
next unless (matcher = /^Forwarding\((\d+)\)\((\d+)\)="(.+?),.*?,(.+?),.*?,(.+?)"$/.match(line))
@@ -113,6 +114,7 @@ def read_network_interfaces
113114
nics = {}
114115
command = ["read_network_interfaces.applescript", @uuid]
115116
info = execute_osa_script(command)
117+
info.strip! # remove leading and trailing whitespaces to match the regex
116118
info.split("\n").each do |line|
117119
next unless (matcher = /^nic(\d+),(.+?)$/.match(line))
118120

0 commit comments

Comments
 (0)