Skip to content

Commit

Permalink
fix process exit val
Browse files Browse the repository at this point in the history
  • Loading branch information
timbrinded committed Oct 30, 2023
1 parent 796f639 commit 8bbcefd
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 65 deletions.
5 changes: 5 additions & 0 deletions .changeset/gorgeous-months-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@moonwall/cli": patch
---

Fix process exit val
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
},
"dependencies": {
"@acala-network/chopsticks": "^0.8.4",
"@moonbeam-network/api-augment": "^0.2400.0",
"@moonbeam-network/api-augment": "^0.2500.0",
"@moonwall/types": "workspace:*",
"@moonwall/util": "workspace:*",
"@polkadot/api": "^10.10.1",
Expand Down Expand Up @@ -92,7 +92,7 @@
"viem": "^1.18.0",
"vitest": "1.0.0-beta.3",
"web3": "4.2.1",
"web3-providers-ws": "4.0.3",
"web3-providers-ws": "4.0.7",
"ws": "^8.14.2",
"yaml": "^2.3.3",
"yargs": "^17.7.2"
Expand Down
5 changes: 3 additions & 2 deletions packages/cli/src/cmds/entrypoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ yargs(hideBin(process.argv))
async (args) => {
if (args.envName) {
process.env.MOON_RUN_SCRIPTS = "true";
await testCmd(args.envName.toString(), { testNamePattern: args.GrepTest });
process.exit(0);
(await testCmd(args.envName.toString(), { testNamePattern: args.GrepTest }))
? process.exit(0)
: process.exit(1);
} else {
console.log("❌ No environment specified");
console.log(`👉 Run 'pnpm moonwall --help' for more information`);
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/internal/localNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function launchNode(cmd: string, args: string[], name: string): Pro

const runningNode = execaCommand(`${cmd} ${args.join(" ")}`, {
all: true,
cleanup: true,
cleanup: false,
detached: false,
}).pipeAll(logLocation);

Expand Down Expand Up @@ -155,7 +155,7 @@ async function checkWebSocketJSONRPC(port: number): Promise<boolean> {
function findPortsByPid(pid: number, retryDelay: number = 10000) {
for (;;) {
const command = `lsof -i -n -P | grep LISTEN | grep ${pid} || true`;
const { stdout } = execaCommandSync(command, { shell: true });
const { stdout } = execaCommandSync(command, { shell: true, cleanup: true });
const ports: number[] = [];
const lines = stdout.split("\n");

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lib/globalContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ export interface IGlobalContextFoundation {

async function isPidRunning(pid: number): Promise<boolean> {
try {
await execaCommand(`ps -p ${pid} -o pid=`);
await execaCommand(`ps -p ${pid} -o pid=`, { cleanup: true });
return true;
} catch {
return false;
Expand Down
67 changes: 9 additions & 58 deletions pnpm-lock.yaml

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

0 comments on commit 8bbcefd

Please sign in to comment.