Skip to content

fix: use @argfile for classpath and java.exe on Windows - #6

Merged
arun279 merged 1 commit into
mainfrom
fix/cli-argfile-and-error-handling
Apr 14, 2026
Merged

fix: use @argfile for classpath and java.exe on Windows#6
arun279 merged 1 commit into
mainfrom
fix/cli-argfile-and-error-handling

Conversation

@arun279

@arun279 arun279 commented Apr 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • Write classpath to target/cucumber-cli-cp.txt argfile with forward slashes, pass @argfile to Java (same as IntelliJ's @idea_arg_file)
  • Return java.exe on Windows to prevent cross-spawn from wrapping in cmd.exe (8K char limit)
  • Catch execution errors and report them on test items instead of silent "no output"

Why v0.2.0 failed

The compile step ran but the Java CLI step never appeared in output. Root cause: resolveJavaExecutable() returned bare java (no .exe), causing cross-spawn to wrap in cmd.exe which has an 8,191-char limit — exceeded by the ~20K classpath.

Test plan

  • Install on Windows, run a specific scenario
  • Verify compile step runs, then Java CLI step runs with @argfile
  • Verify test results appear in Test Explorer
  • If Java is not found, verify clear error message appears (not silent failure)

v0.2.0 failed silently because:
1. resolveJavaExecutable() returned bare 'java' — cross-spawn wrapped
   in cmd.exe which has an 8K char limit, exceeded by the classpath
2. Even without cmd.exe, backslashes in Windows paths are treated as
   escapes by Java's argument parser

Fix: write classpath to an argfile with forward slashes (same as
IntelliJ's @idea_arg_file), return java.exe on Windows to avoid
cmd.exe wrapping, and catch execution errors so they appear on
test items instead of silently disappearing.
@arun279
arun279 merged commit edb80ad into main Apr 14, 2026
1 check passed
@arun279
arun279 deleted the fix/cli-argfile-and-error-handling branch April 14, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant