Setup isolated environment to setup a custom HOME directory as well

This commit is contained in:
Mitchell Hashimoto 2011-11-02 21:38:48 -07:00
parent 4c1f7c586e
commit 4c6f8d2b52
1 changed files with 11 additions and 0 deletions

View File

@ -1,3 +1,5 @@
require "fileutils"
require "log4r" require "log4r"
require "posix-spawn" require "posix-spawn"
@ -27,6 +29,15 @@ module Acceptance
# Create a temporary directory for our work # Create a temporary directory for our work
@tempdir = Tempdir.new("vagrant") @tempdir = Tempdir.new("vagrant")
@logger.info("Initialize isolated environment: #{@tempdir.path}") @logger.info("Initialize isolated environment: #{@tempdir.path}")
# Setup the home and working directories
@homedir = File.join(@tempdir.path, "home")
@workdir = File.join(@tempdir.path, "work")
FileUtils.mkdir(@homedir)
FileUtils.mkdir(@workdir)
@env["HOME"] = @homedir
end end
# Executes a command in the context of this isolated environment. # Executes a command in the context of this isolated environment.