Skip to content

cmd/cue: tool failure is hard to debug #2631

@rogpeppe

Description

@rogpeppe

What version of CUE are you using (cue version)?

$ cue version
cue version v0.0.0-20231004170206-6c71b2c90d63

go version devel go1.21-af8f94e3c5 Tue Jul 11 21:30:51 2023 +0000
      -buildmode exe
       -compiler gc
  DefaultGODEBUG panicnil=1
     CGO_ENABLED 1
          GOARCH amd64
            GOOS linux
         GOAMD64 v1
             vcs git
    vcs.revision 6c71b2c90d63846f2983deb07102253298a568c0
        vcs.time 2023-10-04T17:02:06Z
    vcs.modified false

Does this issue reproduce with the latest stable release?

Yes

What did you do?

! exec cue cmd foo
stdout 'foo'
stdout 'bar'

-- cue.mod/module.cue --
module: "example.com"

-- foo_tool.cue --
package foo
import "tool/file"

command: foo: bar: file.Create & {
	filename: "/something/non-existent"
	contents: "x"
}

What did you expect to see?

A passing test: the failure should at least mention the path to the task that failed.

What did you see instead?

> ! exec cue cmd foo
[stderr]
task failed: open /something/non-existent: no such file or directory
[exit status 1]
> stdout 'foo'
FAIL: /tmp/testscript573993553/x.txtar/script.txtar:2: no match for `foo` found in stdout
error running /tmp/x.txtar in /tmp/testscript573993553/x.txtar

The error message does not mention which task has failed, making it quite hard to determine where the error has arisen, particularly when there are many hundreds of tasks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions