From c471f37955fecb499e2edcd4d1156bcef91ba052 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 20 Nov 2015 15:34:52 -0800 Subject: [PATCH] core: parse line numbers for Vagrantfile syntax errors on Win [GH-6445] --- CHANGELOG.md | 2 ++ lib/vagrant/config/loader.rb | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cfe725dd..d42bd7238 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,8 @@ BUG FIXES: - core: more robust check for admin privs on Windows [GH-5616] - core: properly detect when HTTP server doesn't support byte ranges and retry from scratch [GH-4479] + - core: line numbers show properly in Vagrantfile syntax errors + on Windows [GH-6445] - commands/box: the update command supports CA settings [GH-4473] - commands/box: removing all versions and providers of a box will properly clean all directories in `~/.vagrant.d/boxes` [GH-3570] diff --git a/lib/vagrant/config/loader.rb b/lib/vagrant/config/loader.rb index ef4abe4bd..2bf011231 100644 --- a/lib/vagrant/config/loader.rb +++ b/lib/vagrant/config/loader.rb @@ -221,7 +221,12 @@ module Vagrant line = "(unknown)" if e.backtrace && e.backtrace[0] - line = e.backtrace[0].split(":")[1] + e.backtrace[0].split(":").each do |part| + if part =~ /\d+/ + line = part.to_i + break + end + end end # Report the generic exception