mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-17 23:33:12 +09:00
Exit run scripts with the code that stopped the restart loop (#1212)
run-controller.sh and run-host.sh ran `exit $?` after the `[[ ]]` test, so they exited with the test's status (0) even when the process exited with 8 to ask not to be restarted. Save the status before testing it. The .cmd scripts now pass 8 to `exit /b` explicitly instead of relying on a bare `exit /b` to carry the errorlevel through. Closes #1208. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
154ebe294a
commit
ec2bc6504b
2 files changed
+20
-4
No files matched your search
@@ -195,6 +195,20 @@ describe("create installer CLI", function() {
|
||||
await fs.access(path.join(directory, `run-host${process.platform === "win32" ? ".cmd" : ".sh"}`));
|
||||
});
|
||||
|
||||
it("writes a run script that exits with the code that stopped the restart loop", async function() {
|
||||
if (process.platform === "win32") {
|
||||
this.skip();
|
||||
}
|
||||
await run(hostArgs());
|
||||
const binDir = path.join(directory, "node_modules", ".bin");
|
||||
await fs.mkdir(binDir, { recursive: true });
|
||||
await fs.writeFile(path.join(binDir, "clusteriohost"), "#!/bin/sh\nexit 8\n", { mode: 0o755 });
|
||||
await assert.rejects(
|
||||
execFileAsync(path.join(directory, "run-host.sh"), [], { cwd: directory }),
|
||||
{ code: 8 },
|
||||
);
|
||||
});
|
||||
|
||||
it("adds the trailing slash the host requires to the controller URL", async function() {
|
||||
await run(hostArgs(controllerUrl.slice(0, -1)));
|
||||
assert((await commands()).includes(hostSet("host.controller_url", controllerUrl)));
|
||||
|
||||
Reference in new issue
Block a user