Skip to content

proposal: os/exec: use LookPathAbs by default  #42950

Closed
@rsc

Description

@rsc

exec.Command("ls") calls LookPath to find an "ls" executable to run.
If users are on Windows, or if they are on Unix with "." in their $PATH ahead of /bin, it will run ./ls when that exists.
That's almost never what you really want - see #38736 and related issues.

If we adopt #42420, perhaps we should also make exec.Command default to using LookPathAbs instead of LookPath (unless the command is explicitly "./ls" (.\ls on Windows)).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions