Description
Windows 10 for ARM64 will run ARM32 executables just fine, which is why we're using it for Go builders.
There's currently a bug in which invoking powershell from an arm32 process will fail:
I've worked around that by grabbing a zip of powershell 7.1, adding the unzipped directory to the builder's PATH, and then copying pwsh.exe to powershell.exe. I'm waiting for some builds to finish, but I think that should work alright.
The reason this matters for Go is that some of the tests use powershell just to invoke a simple command:
func runCmd(args ...string) ([]byte, error) {
removeUTF8BOM := func(b []byte) []byte {
if len(b) >= 3 && b[0] == 0xEF && b[1] == 0xBB && b[2] == 0xBF {
return b[3:]
}
return b
}
f, err := ioutil.TempFile("", "netcmd")
if err != nil {
return nil, err
}
f.Close()
defer os.Remove(f.Name())
cmd := fmt.Sprintf(`%s | Out-File "%s" -encoding UTF8`, strings.Join(args, " "), f.Name())
out, err := exec.Command("powershell", "-Command", cmd).CombinedOutput()
I'm pretty sure we can come up with something better than powershell -Command
for the tests, which would make this problem go away. Or sooner or later Microsoft will probably fix it. Or my workaround will suffice.
Either way, I thought I should at least document this.