Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix CLI hanging behavior #1316

Merged
merged 4 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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