diff --git a/bend2/main.ts b/bend2/main.ts index 32cd6c871..3e1a3f498 100755 --- a/bend2/main.ts +++ b/bend2/main.ts @@ -169,7 +169,8 @@ function cli_guide(name: string): void { // cli_update runs the installer again: the one way bend changes. The // command prints first, so the user can run it alone. function cli_update(): void { - const cmd = "curl -fsSL " + ORIGIN + "/install.sh | sh"; + const cmd = "s=$(curl -fsSL " + ORIGIN + + "/install.sh) && printf '%s\\n' \"$s\" | sh"; cli_say(2, cmd + "\n"); process.exitCode = child.spawnSync("sh", ["-c", cmd], { stdio: "inherit" }).status ?? 1; diff --git a/gates/ping.ts b/gates/ping.ts index a72189e0a..f02e4dfec 100644 --- a/gates/ping.ts +++ b/gates/ping.ts @@ -277,9 +277,13 @@ try { check("a dead origin costs one run under four seconds", dead.code === 0 && dead.out.includes("usage:") && Date.now() - t0 < 4000); const was = fs.statSync(BIN).ino; + const no_upd = await bend(["update"], { BEND_ORIGIN: "http://127.0.0.1:1" }); + check("bend update fails when the installer download fails", no_upd.code !== 0 + && fs.statSync(BIN).ino === was); const upd = await bend(["update"]); check("bend update runs the installer again: " + upd.err, upd.code === 0 - && upd.err.startsWith("curl -fsSL " + ORIGIN + "/install.sh | sh\n") + && upd.err.startsWith("s=$(curl -fsSL " + ORIGIN + + "/install.sh) && printf '%s\\n' \"$s\" | sh\n") && plain(upd.out).includes("Bend \u2588 " + ver) && fs.statSync(BIN).ino !== was); const guide = await bend(["guide"]); const base = await bend(["base", "Map"]);