summaryrefslogtreecommitdiff
path: root/lib/chef/util/powershell/cmdlet_result.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/util/powershell/cmdlet_result.rb')
-rw-r--r--lib/chef/util/powershell/cmdlet_result.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/chef/util/powershell/cmdlet_result.rb b/lib/chef/util/powershell/cmdlet_result.rb
index 246701a7bc..31d8d38ccc 100644
--- a/lib/chef/util/powershell/cmdlet_result.rb
+++ b/lib/chef/util/powershell/cmdlet_result.rb
@@ -22,18 +22,25 @@ class Chef::Util::Powershell
class CmdletResult
attr_reader :output_format
- def initialize(status, output_format)
+ def initialize(status, streams, output_format)
@status = status
@output_format = output_format
+ @streams = streams
end
def stderr
@status.stderr
end
+ def stream(name)
+ @streams[name].read
+ end
+
def return_value
if output_format == :object
- Chef::JSONCompat.parse(@status.stdout)
+ Chef::JSONCompat.parse(stream(:json))
+ elsif output_format == :json
+ stream(:json)
else
@status.stdout
end