Skip to content

Fix compiler switches: use /EXE on Windows, --executable elsewhere - #3

Closed
DNSGeek wants to merge 3 commits into
mainfrom
claude/issue-1-20260930-0310
Closed

DNSGeek wants to merge 3 commits into
mainfrom
claude/issue-1-20260930-0310

Conversation

@DNSGeek

@DNSGeek DNSGeek commented Sep 30, 2026

Copy link
Copy Markdown
Owner

PureBasic has no --exe or --run switch. Pass the platform-correct output switch and launch the built executable after a successful compile instead of passing --run. Also auto-detect pbcompilerc.exe (C backend).

Fixes #1

PureBasic has no --exe or --run switch. Pass the platform-correct output
switch and launch the built executable after a successful compile instead
of passing --run. Also auto-detect pbcompilerc.exe (C backend).

Fixes #1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DNSGeek

DNSGeek commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner Author

@claude fix the linting issue

@claude

claude Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Claude finished @DNSGeek's task in 49s —— View job


Lint failure: cause found, but I couldn't fix it

I read "listing" as linting. If you meant something else, let me know.

  • Check CI and find the lint failure
  • Fix the lint errors: blocked, I don't have permission to run npx/npm
  • Commit and push: nothing to push

Why the job fails

The Code Formatting and Linting run (job log) doesn't fail on a lint error. It fails at its final "Commit and push changes" step:

[detached HEAD e2e7629] style: auto-format code with ...
 14 files changed, 16407 insertions(+), 3953 deletions(-)
fatal: You are not currently on a branch.
##[error]Process completed with exit code 128.
  1. npx prettier --write reformats 14 files. That's almost all of src/*.ts, package.json, snippets/, syntaxes/, README.md and LICENSE.md, not just this PR's change to src/compilerService.ts.
  2. The workflow then tries to commit and git push. But actions/checkout on a pull_request event checks out a merge commit with a detached HEAD, so the push fails.

The markdownlint errors (MD013, MD022, MD060 and others in README.md/LICENSE.md) are printed but don't fail the job. markdownlint is run with || echo.

This would fail on any PR, not just this one.

Why I couldn't fix it

  • Formatting the code: the most direct fix is to run Prettier on this branch and commit the result, so CI has nothing left to commit. My npx prettier call was denied, and I won't hand-edit roughly 16k lines of formatter output.
  • Fixing the workflow: the real bug is in .github/workflows/formatting.yml, and GitHub App permissions don't let me change files in .github/workflows (FAQ).

How to fix it

Option A: format once locally (fixes this PR)

npx prettier --write "**/*.{ts,tsx,js,jsx,json}"
npx prettier --write "**/*.md"
git commit -am "style: apply prettier" && git push

Or add Bash(npx:*) to my --allowedTools and ask me again, and I'll do it.

Option B: fix the workflow (stops this happening on future PRs). In formatting.yml, either check out the PR branch:

- uses: actions/checkout@v4
  with:
    ref: ${{ github.head_ref }}

or change the push to git push origin HEAD:${{ github.head_ref }}. Pushes from forked PRs will still fail with this change. For those, skip the commit step (if: github.event.pull_request.head.repo.full_name == github.repository) or switch to prettier --check.
• Branch: claude/issue-1-20260930-0310

@agorangetek

Copy link
Copy Markdown

Hi — confirming the diagnosis, plus what I could verify against a real compiler.

Verified on PureBasic 6.41 C backend, macOS (pbcompiler reports PureBasic 6.41 - C Backend (MacOS X - arm64)):

switch result
--exe Unknown switch: --exe — reproduces the report
--run Unknown switch: --run
/EXE Unknown parameter: /EXE here; slash switches are Windows-only
--executable accepted, and wrote the executable to the exact path given

So the core of the patch is right: neither --exe nor --run exists, and the output switch has to be per platform.

One change I'd suggest. --executable is not in pbcompiler -h, and the official reference documents the output switch as -o, --output, /OUTPUT <filename>. It works on 6.41 — I checked that it honoured the path — but it's an undocumented alias, so nothing promises it on other versions. -o is the safer value for the non-Windows branch:

const exeSwitch = process.platform === 'win32' ? '/EXE' : '-o';

Worth noting the reference is inconsistent about Windows: the cross-platform table lists /OUTPUT, while the Windows example uses /EXE "C:\Project\project.dll". Both presumably work; I could only test the Unix side, so that branch still wants a run on Windows before merge — the caveat you already flagged.

The failing format check is not this PR. It dies in the final push step: actions/checkout leaves a detached HEAD on pull_request, prettier --write reformats 14 files, then git push fails with fatal: You are not currently on a branch. That happens on any PR here. Fixing it means checking out the head ref (with: ref: ${{ github.head_ref }}), pushing as git push origin HEAD:${{ github.head_ref }}, or dropping the auto-commit for prettier --check.

+1 for the pbcompilerc.exe auto-detect — on Windows arm64 there is no ASM backend, so that's the only compiler an arm64 install has.

PureBasic's own reference documents the output switch as
"-o, --output, /OUTPUT <filename>" and the Windows example uses /EXE, but
"--executable" appears nowhere: not in `pbcompiler -h` and not in the manual.
It is accepted by 6.41 and does honour the path, so this is not a live bug --
it is an undocumented alias with nothing promising it on other versions.

-o is the same switch in its documented short form, so the non-Windows branch
now uses it. The /EXE choice for Windows is unchanged and matches the manual's
Windows example.
Use -o rather than the undocumented --executable on Linux/macOS
@DNSGeek DNSGeek closed this Oct 1, 2026
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.

C Backend not compiling.

2 participants