Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Pistonight opened this issue Jan 18, 2025 · 0 comments
Labels
state: needs triage Waiting to be triaged by a maintainer.

Comments

@Pistonight
Copy link
Contributor

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.

@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: needs triage Waiting to be triaged by a maintainer.
Projects
None yet
Development

No branches or pull requests

2 participants