Skip to content

Bug: \program.parse()\ is not awaited -- async action handlers may not complete #10

@404-Page-Found

Description

@404-Page-Found

Description

In \src/index.ts:106:

\\ s
program.parse()
\\

All four subcommand action handlers are \�sync\ functions. However, \program.parse()\ is called synchronously without \�wait. In Commander.js v12, \program.parse()\ is synchronous and does not await async action handlers. The correct method is \�wait program.parseAsync().

Impact

While Node.js typically keeps the event loop alive for pending promises, this is not guaranteed. If any unhandled error occurs elsewhere, or if the process is otherwise terminated, the async action handlers may be interrupted mid-execution. This creates a race condition where branch deletions, remote pruning, or garbage collection could be left in a partially completed state. Additionally, any promise rejections from async handlers become unhandled rejections rather than being catchable.

Suggested Fix

Change to \�wait program.parseAsync()\ and make the main function async.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions