Skip to content

Commit 7bf5ba4

Browse files
jackwenerclaude
andcommitted
fix: allow browser:false commands to run without a page after lazy-load
The C2 fix in PR #337 added a null-page guard after lazy-loading TS modules, but it threw unconditionally — breaking all browser:false commands (bloomberg, apple-podcasts, google, yollomi, etc.) that use func() with a null page. Guard now checks updated.browser !== false. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 37c7ea4 commit 7bf5ba4

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/execution.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ async function runCommand(
9999
// After loading, the module's cli() call will have updated the registry.
100100
const updated = getRegistry().get(fullName(cmd));
101101
if (updated?.func) {
102-
if (!page) throw new CommandExecutionError(`Command ${fullName(cmd)} requires a browser session but none was provided`);
103-
return updated.func(page, kwargs, debug);
102+
if (!page && updated.browser !== false) {
103+
throw new CommandExecutionError(`Command ${fullName(cmd)} requires a browser session but none was provided`);
104+
}
105+
return updated.func(page as IPage, kwargs, debug);
104106
}
105107
if (updated?.pipeline) return executePipeline(page, updated.pipeline, { args: kwargs, debug });
106108
}

0 commit comments

Comments
 (0)