Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

install.sh and graff update: run under POSIX sh (dash)

justrach1ed445250028
diff --git a/install.sh b/install.sh
index 9ef0b095..2eee088b 100644
--- a/install.sh
+++ b/install.sh
@@ -1,5 +1,8 @@
#!/usr/bin/env bash
-set -euo pipefail
+# POSIX sh compatible: `curl ... | sh` runs this under dash on Debian/Ubuntu,
+# which rejects `set -o pipefail`. Enable it only where the shell supports it.
+set -eu
+if (set -o pipefail) 2>/dev/null; then set -o pipefail; fi
# Git Bash / MSYS / Cygwin: graff runs natively, through the PowerShell
# installer. This check must run here, at top level: inside detect_platform,
diff --git a/src/cli.zig b/src/cli.zig
index 43d4ce81..67104500 100644
--- a/src/cli.zig
+++ b/src/cli.zig
@@ -333,16 +333,16 @@ pub fn updateCommand(
// Delegate download/codesign/atomic swap to install.sh. Inherit our stdio
// so its progress (and any sudo prompt) reaches the terminal directly.
- // "set -o pipefail" is required: without it, a failed "curl" is masked
- // by the right-hand "sh" exiting 0 on EOF, and the pipeline reports
- // success while installing nothing — silently.
+ // Download to a temp file, then run it: piping curl into sh would mask a
+ // failed curl (sh exits 0 on EOF) unless "set -o pipefail" is on, and
+ // /bin/sh is dash on Debian/Ubuntu, which rejects that option outright.
//
// `install_url` is user-controllable via GRAFF_INSTALL_URL / HARNESS_INSTALL_URL,
// so it MUST NOT be interpolated into the sh -c string (shell injection).
// Pass it as positional $1 instead — the shell never re-parses it and curl
// receives it verbatim.
var child = std.process.spawn(io, .{
- .argv = &.{ "/bin/sh", "-c", "set -o pipefail; curl -fsSL \"$1\" | HARNESS_NO_GRAFF=1 sh", "sh", install_url },
+ .argv = &.{ "/bin/sh", "-c", "f=$(mktemp) || exit 1; trap 'rm -f \"$f\"' EXIT; curl -fsSL \"$1\" -o \"$f\" || exit 1; HARNESS_NO_GRAFF=1 sh \"$f\"", "sh", install_url },
}) catch |err|
std.process.fatal("update: could not launch installer: {t}", .{err});
const term = child.wait(io) catch std.process.fatal("update: installer did not exit cleanly", .{});