summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan McLellan <btm@loftninjas.org>2017-12-21 17:19:46 -0500
committerGitHub <noreply@github.com>2017-12-21 17:19:46 -0500
commit7432d67a60a2366d4208e05b34ed35d3e159aeca (patch)
tree489d4232c5666c0f6761bbf82816e44737b5242d
parent3d46256c31fab1227cf8b494e17d8c103229b2f0 (diff)
parentf381504a00fa65e609ca4942483881a0aea2416a (diff)
downloadchef-7432d67a60a2366d4208e05b34ed35d3e159aeca.tar.gz
Merge pull request #6664 from TheLunaticScripter/fix_powershell_output
[MSYS-692] Fix issue with PowerShell function buffer
-rw-r--r--distro/powershell/chef/chef.psm16
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) {