Skip to content

Commit

Permalink
Merge pull request #250 from thheinen/thheinen/fix-targetmode-timeouts
Browse files Browse the repository at this point in the history
Fix execution in target mode with cwd parameter given
  • Loading branch information
rahulgoel1 authored Oct 8, 2024
2 parents 14a5891 + 83c8d91 commit 0cabb84
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/mixlib/shellout/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ def __shell_out_command(*args, **options)
command = __join_whitespace(args)
unless ChefUtils.windows?
if options[:cwd]
command.prepend sprintf("cd %s;", options[:cwd])
# as `timeout` is used, commands need to be executed in a subshell
command = "sh -c 'cd #{options[:cwd]}; #{command}'"
end

if options[:input]
Expand Down

0 comments on commit 0cabb84

Please sign in to comment.