diff options
author | John Snow <thelunaticscripter@outlook.com> | 2017-12-13 09:26:39 -0500 |
---|---|---|
committer | John Snow <thelunaticscripter@outlook.com> | 2017-12-21 16:24:42 -0500 |
commit | f381504a00fa65e609ca4942483881a0aea2416a (patch) | |
tree | 489d4232c5666c0f6761bbf82816e44737b5242d | |
parent | 3d46256c31fab1227cf8b494e17d8c103229b2f0 (diff) | |
download | chef-f381504a00fa65e609ca4942483881a0aea2416a.tar.gz |
Fix issue with Powershell function buffer
Issue Fixed:
https://github.com/chef/chef-dk/issues/1236
Signed-off-by: John Snow <thelunaticscripter@outlook.com>
-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) { |