Skip to content

ignore_error not working on new built-in cp command #2466

@VnUgE

Description

@VnUgE

Description

  • The new built-in cp command to copy a file that may or may not exist, with the ignore_error: true property set on the cmd: scope
  • Expected cp command errors to be suppressed
  • cp errors were not suppressed and tasks fail
  • No change if -f is used or not.
  • Adding powershell before the cp command works as expected even if the powershell command fails.

This task is just a best-effort file copy for some testing, and some files may not exist for now, and simply suppressing the error is the simplest solution for now.

Example error

task: Failed to run task "dev-plugins-fetch": GetFileAttributesEx C:\tests\config\Essentials.Accounts.json: The system cannot find the file specified.

Version

3.45.4

Operating system

Windows

Experiments Enabled

None

Example Taskfile

version: 3

tasks:

  default:
    cmds:
     - task: dev-build-plugin
       vars:
         ASM_NAME: "TestAssembly"
         OUTPUT_DIR: "{{ .USER_WORKING_DIR }}"

  dev-build-plugin:
    internal: true
    dir: '..'
    requires: { ASM_NAME, OUTPUT_DIR}
    cmds:
     - cmd: mkdir -p '{{ .OUTPUT_DIR }}'

     - cmd: cp -f config/{{ .ASM_NAME }}.json '{{ .OUTPUT_DIR }}/{{ .ASM_NAME }}.json'
       ignore_error: true

Metadata

Metadata

Assignees

No one assigned

    Labels

    state: needs triageWaiting to be triaged by a maintainer.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions