What happened
I copied the official Perry commander example and compiled it successfully, but the resulting native binary ignores the CLI at runtime. --help and serve --port 3000 both exit with status 0 and print nothing to stdout or stderr.
What you expected
I expected the compiled binary to behave like the commander example normally does: --help should print help text, and serve --port 3000 should run the action and print Starting server on port 3000.
Minimal reproduction
This is the exact sample from the Perry docs commander section.
import { Command } from "commander";
const program = new Command();
program.name("my-cli").version("1.0.0").description("My CLI tool");
program
.command("serve")
.option("-p, --port <number>", "Port number")
.option("--verbose", "Verbose output")
.action((options) => {
console.log(`Starting server on port ${options.port}`);
});
program.parse(process.argv);
Command you ran:
npm install commander
perry main.ts -o app
./app --help
./app serve --port 3000
./app serve --port 3000 --verbose
Environment
- Perry version:
perry 0.5.178
- Host OS:
macOS 26.4.1 (arm64)
- Target:
native
- Installed via: brew
Diagnostic output
perry main.ts -o app succeeds:
Collecting modules...
Found 1 module(s): 1 native, 0 JavaScript
Generating code...
Wrote object file: tmp_perry_commander_docs_ts.o
Linking (with stdlib)...
Wrote executable: .tmp-perry-commander-docs-bin
Binary size: 2.9MB
Runtime output is empty for all of these commands, even though they exit successfully:
$ ./app --help
# exit code: 0
# stdout: empty
# stderr: empty
$ ./app serve --port 3000
# exit code: 0
# stdout: empty
# stderr: empty
$ ./app serve --port 3000 --verbose
# exit code: 0
# stdout: empty
# stderr: empty
perry doctor on this machine:
Perry Doctor
Environment Checks
──────────────────
[OK] perry version: 0.5.178
[OK] update status: no cached info (run `perry update --check-only`)
[OK] system linker (cc): Apple clang version 17.0.0 (clang-1700.6.4.2)
[WARN] runtime library: not found - run: cargo build --release -p perry-runtime
[OK] project config (perry.toml): found
All critical checks passed with some warnings.
Anything else
- I copied this from the Perry docs
commander example, so this currently looks like a docs-backed reproduction rather than custom project code.
- A manual
process.argv.slice(2) parser works as a workaround in the same environment.
- I also observed that
process.argv itself is populated in Perry, so the failure seems specific to commander behavior under Perry rather than missing argv data.
What happened
I copied the official Perry
commanderexample and compiled it successfully, but the resulting native binary ignores the CLI at runtime.--helpandserve --port 3000both exit with status 0 and print nothing to stdout or stderr.What you expected
I expected the compiled binary to behave like the
commanderexample normally does:--helpshould print help text, andserve --port 3000should run the action and printStarting server on port 3000.Minimal reproduction
This is the exact sample from the Perry docs
commandersection.Command you ran:
Environment
perry 0.5.178macOS 26.4.1 (arm64)nativeDiagnostic output
perry main.ts -o appsucceeds:Runtime output is empty for all of these commands, even though they exit successfully:
perry doctoron this machine:Anything else
commanderexample, so this currently looks like a docs-backed reproduction rather than custom project code.process.argv.slice(2)parser works as a workaround in the same environment.process.argvitself is populated in Perry, so the failure seems specific tocommanderbehavior under Perry rather than missing argv data.