Skip to content

Commit

Permalink
Finish tests and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tmpolaczyk committed Oct 30, 2023
1 parent e3fb672 commit 3b1e6e8
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 151 deletions.
103 changes: 3 additions & 100 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
},
"dependencies": {
"@zombienet/orchestrator": "^0.0.52",
"execa": "^8.0.1",
"inquirer": "^9.2.11",
"ps-node": "^0.1.6"
}
Expand Down
15 changes: 9 additions & 6 deletions test/scripts/zombienetRestart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { exec, spawn, execSync } from "child_process";
import { readFileSync, writeFileSync, readlinkSync, unlinkSync } from "fs";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import os from "os";
import path from "path";
import inquirer from "inquirer";

const getEnvVariables = (pid: number) => {
Expand Down Expand Up @@ -112,7 +110,7 @@ yargs(hideBin(process.argv))
let { command, arguments: args } = processInfo;

if (argv["edit-cmd"]) {
const tempFilePath = path.join(os.tmpdir(), `zombienet-restart-cmd-${Date.now()}.txt`);
const tempFilePath = execSync("mktemp /tmp/zombienet-restart-cmd-XXXXXX").toString().trim();
writeFileSync(tempFilePath, `${command} ${args.join(" ")}`);

const editor = process.env.EDITOR || "vim"; // Default to 'vim' if EDITOR is not set
Expand Down Expand Up @@ -152,9 +150,14 @@ yargs(hideBin(process.argv))
env: Object.fromEntries(envVariables.map((e) => e.split("=", 2))),
});

process.on("SIGINT", () => {
console.log('zombienetRestart: got SIGINT');
child.kill("SIGINT");
["SIGINT", "SIGTERM"].forEach((signal) => {
process.on(signal, () => {
console.log("zombienetRestart: got ", signal);
if (child) {
child.kill(signal);
}
process.exit();
});
});
}, argv["wait-ms"]);
});
Expand Down
Loading

0 comments on commit 3b1e6e8

Please sign in to comment.