Skip to content

Fix ProcessRunner::start() to handle Windows executables without .exe extension#5180

Merged
matejk merged 4 commits intomainfrom
fix/processrunner-windows-exe-extension
Feb 4, 2026
Merged

Fix ProcessRunner::start() to handle Windows executables without .exe extension#5180
matejk merged 4 commits intomainfrom
fix/processrunner-windows-exe-extension

Conversation

@matejk
Copy link
Copy Markdown
Contributor

@matejk matejk commented Feb 3, 2026

Summary

  • Added public File::getExecutablePath() method that returns the executable path (appends .exe on Windows if no extension present)
  • Fixed ProcessRunner::start() to use getExecutablePath() before checking file existence
  • Added unit tests for getExecutablePath()

Test plan

  • All FileTest tests pass (22 tests)
  • Verified getExecutablePath() returns correct paths on Unix (unchanged) and Windows (.exe appended)

@matejk matejk added this to the Release 1.15.0 milestone Feb 3, 2026
@matejk matejk force-pushed the fix/processrunner-windows-exe-extension branch from 6edec53 to cb188d4 Compare February 3, 2026 15:29
@matejk matejk force-pushed the fix/processrunner-windows-exe-extension branch from cb188d4 to 37019ef Compare February 3, 2026 17:30
@matejk matejk force-pushed the fix/processrunner-windows-exe-extension branch from 4af7213 to 57459a6 Compare February 3, 2026 19:24
@matejk matejk merged commit 985c828 into main Feb 4, 2026
100 checks passed
@aleks-f
Copy link
Copy Markdown
Member

aleks-f commented Feb 4, 2026

@matejk appending .exe to a file that does not have it creates a file name that does not exist. PATHEXT environment variable already does the same thing as this commit, but it still won't work if the file does not actually have one of the extensions listed in PATHEXT.

A file named File does not mean a file named File.exe exists, but the reverse works by virtue of the PATHEXT(if present) - you can execute File.exe by just issuing File command

c:\Temp>dir Test
 Volume in drive C has no label.
 Volume Serial Number is CAC2-980E

 Directory of c:\Temp

02/02/2026  03:31 PM         5,148,160 Test
               1 File(s)      5,148,160 bytes
               0 Dir(s)  35,160,547,328 bytes free

c:\Temp>.\Test
'.\Test' is not recognized as an internal or external command,
operable program or batch file.

c:\Temp>.\Test.exe
'.\Test.exe' is not recognized as an internal or external command,
operable program or batch file.

c:\Temp>move Test Test.exe
        1 file(s) moved.

c:\Temp>echo %PATHEXT%
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

c:\Temp>.\Test
Hello world

@matejk
Copy link
Copy Markdown
Contributor Author

matejk commented Feb 6, 2026

You are right. I'll prepare proper implementation.

@matejk matejk deleted the fix/processrunner-windows-exe-extension branch February 7, 2026 14:12
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.

2 participants