Skip to content

Commit ccedcd9

Browse files
fix(maestro): use a portable mktemp template in run_maestro
`mktemp -t maestro-run` works on BSD/macOS, which appends the random suffix itself, but GNU coreutils requires at least 6 X's in the template. So on the Linux Android runners every flow printed mktemp: too few X's in template 'maestro-run' '': No such file or directory (os error 2) — log_file was empty, so the tee redirection failed and maestro never ran. iOS was unaffected, which is why this passed local and macOS testing. Use an explicit XXXXXX template, which both implementations accept, and fall back to a PID-based path if mktemp fails for any other reason: artifact plumbing must never be what decides whether the tests run. Audited the rest of the commands added in this series (tr -c, grep -qE) — both POSIX, and already used by the pre-existing recording code that runs on Android. Verified by stubbing a GNU-strict mktemp on PATH: reproduces the CI error with the old form and run_maestro completes with the new one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 413da76 commit ccedcd9

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

maestro/helpers/helpers.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,17 @@ run_maestro() {
159159
local flow="$1"
160160
shift
161161
local log_file
162-
log_file="$(mktemp -t maestro-run)"
162+
# Explicit XXXXXX template, not `mktemp -t maestro-run`: BSD/macOS mktemp appends the random
163+
# suffix itself, but GNU coreutils (the Linux Android runners) requires at least 6 X's in the
164+
# template and fails with "too few X's in template", leaving log_file empty and every
165+
# redirection to it failing. Works on both.
166+
log_file="$(mktemp "${TMPDIR:-/tmp}/maestro-run.XXXXXX")" || log_file=""
167+
if [ -z "$log_file" ]; then
168+
# Never let artifact plumbing decide whether tests run: fall back to a fixed path so the
169+
# flow still executes (classification just loses its input if that also fails).
170+
log_file="${TMPDIR:-/tmp}/maestro-run.$$"
171+
: > "$log_file" 2>/dev/null || true
172+
fi
163173

164174
DEBUG_RUN_DIR="$DEBUG_OUTPUT_DIR/${PLATFORM}-$(basename "${flow%.yaml}" | tr -c 'A-Za-z0-9._-' '_')"
165175
rm -rf "$DEBUG_RUN_DIR"

0 commit comments

Comments
 (0)