Skip to content

Running Task with TASK_CORE_UTILS=1 set still uses the host system's core utils #2459

@ezzatron

Description

@ezzatron

Description

I'm trying to write a cross-platform Taskfile for use by both macOS and Windows devs. I'm authoring the Taskfile on macOS, and getting Windows devs to test it out.

I ran into an issue where I was using cp -a in some copy commands, but this flag is not available in the Go core utils' version of cp. Fair enough.

I'm trying to use the TASK_CORE_UTILS environment variable to enable the Go core utils while running on macOS, so that I can find and eliminate these kinds of issues without having to get Windows devs to try it out every time I make another fix.

The problem is, it really seems like TASK_CORE_UTILS has no effect. With the following Taskfile:

version: "3"

tasks:
  default: cp

When running under Windows, it's easy to tell that the Go core utils are working:

$ task
task: [default] cp
Usage: cp [-RrifvP] file[s] ... dest

  -P    don't follow symlinks (shorthand)
  -R    copy file hierarchies (shorthand)
  -RECURSIVE
        copy file hierarchies
  -f    force overwrite files (shorthand)
  -force
        force overwrite files
  -i    prompt about overwriting file (shorthand)
  -interactive
        prompt about overwriting file
  -no-dereference
        don't follow symlinks
  -r    alias to -R recursive mode (shorthand)
  -recursive
        alias to -R recursive mode
  -v    verbose copy mode (shorthand)
  -verbose
        verbose copy mode
task: Failed to run task "default": insufficient arguments

But no matter how I run the task on macOS, task doesn't seem use the Go core utils:

$ env TASK_CORE_UTILS=1 task                                                                                                                   took 82ms at 20:30:45
task: [default] cp
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-aclpSsvXx] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-aclpSsvXx] source_file ... target_directory
task: Failed to run task "default": exit status 64

The command above is basically verbatim from the FAQ, but I've tried every conceivable variant and nothing works.

Version

3.44.1

Operating system

macOS

Experiments Enabled

No response

Example Taskfile

version: "3"

tasks:
  default: cp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions