-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#8410) Cleanup and fix Windows support in Puppet::Util.execute
The primary change in this commit is fixing the support for Windows in Puppet::Util.execute. However, properly testing this commit required significant refactoring (which was long overdue for this old code) for testability. The functionality for executing on posix and windows was extracted into platform-specific methods, execute_posix and execute_windows. These methods are self-contained and will both return the PID of the child process, which the caller then waits on before reading and returning the output of the command.
- Loading branch information
Showing
4 changed files
with
380 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'spec_helper' | ||
|
||
describe Puppet::Util do | ||
describe "#execute" do | ||
it "should properly allow stdout and stderr to share a file" do | ||
command = "ruby -e '(1..10).each {|i| (i%2==0) ? $stdout.puts(i) : $stderr.puts(i)}'" | ||
|
||
Puppet::Util.execute(command, :combine => true).split.should =~ [*'1'..'10'] | ||
end | ||
end | ||
end |
Oops, something went wrong.