update: the fake open in the relaunch test keeps -n on Linux

TestRelaunchOpenTriedAgain was red on ubuntu CI at 27a8255fd (run
40004148936): opened "<bundle> --args tray", want "-n <bundle> --args
tray". The relaunch passed -n; the test's fake `open` lost it. It wrote
its arguments with echo "$@", and ubuntu's /bin/sh is dash, whose echo
takes a leading -n as its own flag. macOS's sh is bash, so it passed
there. The fake now writes them with printf '%s\n' "$*".

Run: in Docker golang:1.26.8 (GOTOOLCHAIN=local, -tags nogui) the old
test fails the same way as CI and the new one passes go test
./internal/update -run TestRelaunch; on macOS go test ./internal/update
-run TestRelaunch passes. Test-only change, no release.
This commit is contained in:
yetone
2026-10-24 02:47:28 +08:00
parent a218946341
commit 2b4c0664ee
+1 -1
View File
@@ -29,7 +29,7 @@ if [ $n -le ` + strconv.Itoa(fails) + ` ]; then
echo "_LSOpenURLsWithCompletionHandler() failed for the application $app with error -600." >&2
exit 1
fi
echo "$@" > "$d/opened"
printf '%s\n' "$*" > "$d/opened"
`
if err := os.WriteFile(filepath.Join(dir, "open"), []byte(script), 0o755); err != nil {
t.Fatal(err)