Skip to content

Option/ENV var to disable internal command (always resolve executable) for better cross-platform support #2005

@Pistonight

Description

@Pistonight

Description

I use task on both Linux and Windows. So far, I am mostly successful with cross-platform commands by installing https://github.com/uutils/coreutils and making shim scripts like rm.cmd, cp.cmd, mkdir.cmd. However, this doesn't work in Task for internal commands such as mkdir. Task seems to pass the command directly to Command Prompt, which calls the interal mkdir command instead of mkdir.cmd or mkdir.exe.

So it would be nice to have a way to specify I always want to look for the executable in PATH instead of using the platform's builtin. So for the task below, it will find mkdir in PATH then pass the full path of the executable to the shell

tasks:
  build:
    cmds:
      - mkdir -p foo

Ideally this doesn't need to be specified in every task or Taskfile - so something like an environment variable TASK_FORCE_EXECUTABLE=1 or some kind of persistent config would be nice

I also remember this used to work in the past, but I couldn't find anything in the change log that's related, so I think it's probably a Windows update that broke it :(. My workaround right now is $(which mkdir) -p foo - which executes my which.exe to get the full path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: execChanges related to the execution of commands.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions