Skip to content
This repository was archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #17 from motns/command_exit_status_fix
Browse files Browse the repository at this point in the history
Fix for sandbox block not returning exit status
  • Loading branch information
Seth Vargo committed Apr 3, 2013
2 parents 8389efd + 9e28ea9 commit 77590de
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/strainer/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,18 @@ def run!
# when the block is finished.
#
# @yield The block to execute inside the sandbox
# @return [Boolean]
# `true` if the command exited successfully, `false` otherwise
def inside_sandbox(&block)
Strainer.ui.debug "Changing working directory to '#{Strainer.sandbox_path}'"
original_pwd = ENV['PWD']

ENV['PWD'] = Strainer.sandbox_path.to_s
Dir.chdir(Strainer.sandbox_path, &block)
success = Dir.chdir(Strainer.sandbox_path, &block)
ENV['PWD'] = original_pwd

Strainer.ui.debug "Restored working directory to '#{original_pwd}'"
success
end

# Have this command output text, prefixing with its output with the
Expand Down

0 comments on commit 77590de

Please sign in to comment.