Skip to content

Commit 3487cc2

Browse files
author
Aliwoto
committed
Fix minor issues.
Fix the issue that was causing the GetPurifiedPowerShellOutput function to return invalid value. Signed-off-by: Aliwoto <[email protected]>
1 parent 490ddbe commit 3487cc2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

ssg/shellUtils/helpers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ func executePowerShell(
198198

199199
if config.RemovePowerShellPrompt && !strings.Contains(command, "function prompt") {
200200
// hacky way of getting rid of powershell prompt
201-
command = PowerShellPromptOverride + "\n" + command
201+
command = PowerShellPromptOverride + "\n" + command + "\n"
202202
}
203203

204204
cmd = exec.Command(config.TargetRunner, config.PrimaryArgs...)

tests/powershell_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ func TestPowerShell01(t *testing.T) {
2929
}
3030

3131
func TestPowerShell02(t *testing.T) {
32+
//Write-Output ("ok" + $PSVersionTable.PSVersion.Major.ToString() + "`n`n" + $PSVersionTable.PSVersion)
3233
result := ssg.RunPowerShell("$PSVersionTable.PSVersion")
3334
result.PurifyPowerShellOutput()
3435

@@ -45,3 +46,10 @@ func TestPowerShell03(t *testing.T) {
4546

4647
log.Println(result.Stdout)
4748
}
49+
50+
func TestPowerShell04(t *testing.T) {
51+
result := ssg.RunPowerShell("Write-Output (\"ok\" + $PSVersionTable.PSVersion.Major.ToString() + \"`n`n\" + $PSVersionTable.PSVersion)")
52+
result.PurifyPowerShellOutput()
53+
54+
fmt.Println(result.Stdout)
55+
}

0 commit comments

Comments
 (0)