Skip to content

Function pattern doesn't work with exec.Run #3658

Answered by myitcv
maxstepanov asked this question in Q&A
Discussion options

You must be logged in to vote

As @infogulch alluded, the cue cmd workflow specification is a bit brittle in places. Noting #1325 as the tracking issue to fix/improve on that.

It appears that two things are proving to be your "undoing" here:

  • the ().result pattern
  • the use of _res to declare a task within the _printExec task

Consider the following fix (written as a testscript-txtar repro):

exec cue cmd generate
cmp stdout stdout.golden

-- fixed_tool.cue --
package main

import (
	"tool/cli"
	"tool/exec"
)

_exec: {
	kind: string | *"some-default"

	_ex: exec.Run & {
		cmd: ["/bin/bash", "-c", "echo \(kind)"]
		stdout: string
	}
	result: _ex.stdout
}

_plain: {
	kind:   string | *"some-default"
	result: kind
}

command…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@maxstepanov
Comment options

Comment options

You must be logged in to vote
2 replies
@maxstepanov
Comment options

@maxstepanov
Comment options

Answer selected by maxstepanov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants