diff options
-rw-r--r-- | distro/powershell/chef/chef.psm1 | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/distro/powershell/chef/chef.psm1 b/distro/powershell/chef/chef.psm1 index 1a5e2cc5eb..05fee05e5e 100644 --- a/distro/powershell/chef/chef.psm1 +++ b/distro/powershell/chef/chef.psm1 @@ -236,7 +236,6 @@ function Run-ExecutableAndWait($AppPath, $ArgumentString) { throw "Unable to create process [$ArgumentString]. Error code $reason." } - $sb = New-Object System.Text.StringBuilder $buffer = New-Object byte[] 1024 # Initialize reference variables @@ -270,7 +269,7 @@ function Run-ExecutableAndWait($AppPath, $ArgumentString) { while ([Chef.Kernel32]::ReadFile($hReadOut, $buffer, $buffer.Length, [ref] $bytesRead, 0)) { $output = [Text.Encoding]::UTF8.GetString($buffer, 0, $bytesRead) if ($output) { - [void]$sb.Append($output) + $output } if ($bytesRead -lt $buffer.Length) { # Partial buffer indicating the end of stream, break out of ReadFile loop @@ -307,9 +306,6 @@ function Run-ExecutableAndWait($AppPath, $ArgumentString) { } } - # Return output obtained from child process stdout/stderr - $sb.ToString() - # Cleanup handles $success = [Chef.Kernel32]::CloseHandle($pi.hProcess) if (-Not $success) { |