Skip to content

Commit

Permalink
Merge pull request #1316 from polywrap/pileks/hotfix-cli-hanging
Browse files Browse the repository at this point in the history
Hotfix CLI hanging behavior
  • Loading branch information
dOrgJelli authored Oct 11, 2022
2 parents e98546f + b42e889 commit 299003a
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ export const run = async (argv: string[]): Promise<void> => {
}
}

program.parse(argv);
await program.parseAsync(argv);
};
5 changes: 2 additions & 3 deletions packages/cli/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ async function run(options: BuildCommandOptions) {
const result = await execute();

if (!result) {
process.exitCode = 1;
return;
process.exit(1);
}
} else {
// Execute
Expand Down Expand Up @@ -239,5 +238,5 @@ async function run(options: BuildCommandOptions) {
});
}

process.exitCode = 0;
process.exit(0);
}
8 changes: 3 additions & 5 deletions packages/cli/src/commands/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ async function run(options: CodegenCommandOptions) {

const projectType = await project.getManifestLanguage();

let result = false;

const schemaComposer = new SchemaComposer({
project,
client,
Expand All @@ -131,7 +129,7 @@ async function run(options: CodegenCommandOptions) {
project,
});

result = await codeGenerator.generate();
const result = await codeGenerator.generate();

// HACK: Codegen outputs wrap.info into a build directory for plugins, needs to be moved into a build command?
if (isPluginManifestLanguage(projectType)) {
Expand All @@ -153,8 +151,8 @@ async function run(options: CodegenCommandOptions) {

if (result) {
logger.info(`🔥 ${intlMsg.commands_codegen_success()} 🔥`);
process.exitCode = 0;
process.exit(0);
} else {
process.exitCode = 1;
process.exit(1);
}
}
2 changes: 1 addition & 1 deletion packages/cli/src/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ async function run(
}
}

generateProjectTemplate(command, lang, projectDir)
await generateProjectTemplate(command, lang, projectDir)
.then(() => {
let readyMessage;
if (command === "wasm") {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ async function run(options: DeployCommandOptions): Promise<void> {
);
}
}
return;
process.exit(0);
}

function sanitizePackages(packages: string[]) {
Expand Down
7 changes: 3 additions & 4 deletions packages/cli/src/commands/docgen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ async function run(command: DocType, options: DocgenCommandOptions) {
})
);

process.exitCode = 1;
return;
process.exit(1);
}

await project.validate();
Expand All @@ -154,8 +153,8 @@ async function run(command: DocType, options: DocgenCommandOptions) {

if (await codeGenerator.generate()) {
logger.info(`🔥 ${intlMsg.commands_docgen_success()} 🔥`);
process.exitCode = 0;
process.exit(0);
} else {
process.exitCode = 1;
process.exit(1);
}
}
1 change: 1 addition & 0 deletions packages/cli/src/commands/infra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,5 @@ async function run(
default:
throw Error(intlMsg.commands_infra_error_never());
}
process.exit(0);
}
2 changes: 1 addition & 1 deletion packages/cli/src/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const _run = async (options: WorkflowCommandOptions) => {
const { data, error, status } = jobResult;

if (error !== undefined) {
process.exitCode = 1;
process.exit(1);
}

const output: WorkflowOutput = { id, status, data, error };
Expand Down

0 comments on commit 299003a

Please sign in to comment.