Skip to content
Snippets Groups Projects
Commit 8855f22e authored by Georgi N. Georgiev's avatar Georgi N. Georgiev
Browse files

Merge branch 'fix-powershell-stdin-data-race' into 'main'

Fix powershell stdin data race

See merge request gitlab-org/gitlab-runner!5507



Merged-by: Georgi N. Georgiev's avatarGeorgi N. Georgiev <ggeorgiev@gitlab.com>
Approved-by: Georgi N. Georgiev's avatarGeorgi N. Georgiev <ggeorgiev@gitlab.com>
Co-authored-by: default avatarGuillaume CHAUVEL <guillaume.chauvel@gmail.com>
parents 4fc4e500 4227f7c4
No related branches found
No related tags found
No related merge requests found
......@@ -110,8 +110,6 @@ func NewPsWriter(b *PowerShell, info common.ShellScriptInfo) *PsWriter {
}
}
var encoder = unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM).NewEncoder()
func stdinCmdArgs(shell string, preCmds ...string) []string {
if shell == SNPwsh {
return pwshStdinCmdArgs(shell, preCmds...)
......@@ -146,7 +144,7 @@ func pwshStdinCmdArgs(shell string, preCmds ...string) []string {
sb.WriteString("$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding\r\n")
sb.WriteString(shell + " -NoProfile -NonInteractive -Command -\r\n")
sb.WriteString("if(!$?) { Exit &{if($LASTEXITCODE) {$LASTEXITCODE} else {1}} }")
encoded, _ := encoder.String(sb.String())
encoded, _ := unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM).NewEncoder().String(sb.String())
return append(
defaultPowershellFlags,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment