Fixes #11022: Ensure correct line is used for windows exceptions
Prior to this commit, if there was a config error inside a provider block, Vagrant wouldn't grab the right backtrace token on windows since the api is different for ruby on Windows compared to all other platforms. This commit ensures that the proper line number is chosen so the error message is correct.
This commit is contained in:
parent
ccf99d8c0c
commit
09a37e0767
|
@ -509,7 +509,13 @@ module VagrantPlugins
|
|||
|
||||
line = "(unknown)"
|
||||
if e.backtrace && e.backtrace[0]
|
||||
line = e.backtrace[0].split(":")[1]
|
||||
if Vagrant::Util::Platform.windows?
|
||||
# path is split into two tokens on windows for some reason...
|
||||
# where 0th is drive letter, 1st is path, so line number is token 2
|
||||
line = e.backtrace[0].split(":")[2]
|
||||
else
|
||||
line = e.backtrace[0].split(":")[1]
|
||||
end
|
||||
end
|
||||
|
||||
raise Vagrant::Errors::VagrantfileLoadError,
|
||||
|
|
Loading…
Reference in New Issue