Skip to content

commandv on Windows: doesn't search without .exe (docs say it should) #1330

@andrei-markeev

Description

@andrei-markeev

Contact Details

No response

What happened?

It seems that the the logic for .exe / .com automatic suffixing was removed in c88f95a, however, it was never updated in the docs.

We automatically suffix .com and .exe for all platforms when path searching.

(https://github.com/jart/cosmopolitan/blob/master/tool/net/help.txt#L2880)

This is honestly very confusing. I was convinced commandv doesn't work on Windows at all and doing some work arounds until I accidentally spotted that it actually works if you provide the extension.

I thought to create an MR with help update, but then I noticed this comment in a6baba1:

The WIN32 CreateProcess() function does not require an .exe or .com
suffix in order to spawn an executable.

So I am a bit confused, maybe it's a bug and the suffixing should be reintroduced after all?

Version

redbean 3.0.0

What operating system are you seeing the problem on?

Windows

Relevant log output

>: unix.commandv('wsl')
nil     "commandv() failed: No such file or directory"
>: unix.commandv('calc')
nil     "commandv() failed: No such file or directory"
>: unix.commandv('wsl.exe')
"/C/WINDOWS/system32/wsl.exe"
>: unix.commandv('calc.exe')
"/C/WINDOWS/system32/calc.exe"

Metadata

Metadata

Assignees

No one assigned

    Labels

    low severityUsed to report low severity bugs (e.g. cosmetic issues, non critical UI glitches)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions