Skip to content

Instantly share code, notes, and snippets.

@tknerr
Last active December 20, 2015 01:19
Show Gist options
  • Save tknerr/6048433 to your computer and use it in GitHub Desktop.
Save tknerr/6048433 to your computer and use it in GitHub Desktop.
Modified vagrant.bat to avoid hashicorp/vagrant#1833
@ECHO OFF
REM Don't set variables globally
SETLOCAL
REM Some variables
SET "EMBEDDED_DIR=%~dp0\..\embedded"
REM Set environmental variables
SET "GEM_HOME=%EMBEDDED_DIR%\gems"
SET "GEM_PATH=%GEM_HOME%"
SET "GEMRC=%EMBEDDED_DIR%\etc\gemrc"
REM Export an enviromental variable to say we're in a Vagrant
REM installer created environment.
SET "VAGRANT_INSTALLER_ENV=1"
SET "VAGRANT_INSTALLER_EMBEDDED_DIR=%EMBEDDED_DIR%"
REM Prepend embedded bin to PATH so we prefer those binaries
SET "PATH=%EMBEDDED_DIR%\bin;%EMBEDDED_DIR%\gnuwin32\bin;%PATH%"
REM Remove RUBYOPT, which causes serious problems.
SET RUBYOPT=
REM Run Vagrant...
"%EMBEDDED_DIR%\..\embedded\bin\ruby.exe" "%EMBEDDED_DIR%/../embedded/gems/bin/%~n0" %*
REM Store the exit status so we can re-use it later
SET "VAGRANT_EXIT_STATUS=%ERRORLEVEL%"
REM Exit with the proper exit status from Vagrant
exit /b %VAGRANT_EXIT_STATUS%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment