this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Allow setting working directory for exec.Run

Fixes #536

Closes #537
https://github.com/cuelang/cue/pull/537

GitOrigin-RevId: 5bb80f0ec131e8d1c9cdbe9abdb37429bb1f8359
Change-Id: I4d93e6930c82ea29454b3c53c898b60d70155be6
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/9922
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>

authored by

chai2010 and committed by
Marcel van Lohuizen
8e053d40 e8de4b1f

+41 -2
+28
cmd/cue/cmd/testdata/script/cmd_dir.txt
··· 1 + cue cmd ls 2 + cmp stdout expect-stdout 3 + 4 + -- expect-stdout -- 5 + a.txt 6 + b.txt 7 + 8 + -- ls-work-dir/a.txt -- 9 + -- ls-work-dir/b.txt -- 10 + 11 + -- ls_tool.cue -- 12 + package ls 13 + 14 + command: ls: { 15 + ls: { 16 + kind: "exec" 17 + cmd: "ls" 18 + dir: "ls-work-dir" 19 + stdout: string 20 + } 21 + 22 + task: display: { 23 + kind: "print" 24 + text: ls.stdout 25 + } 26 + } 27 + 28 + -- cue.mod --
+4
pkg/tool/exec/doc.go
··· 11 11 // // cmd is the command to run. 12 12 // cmd: string | [string, ...string] 13 13 // 14 + // // dir specifies the working directory of the command. 15 + // // The default is the current working directory. 16 + // dir?: string 17 + // 14 18 // // env defines the environment variables to use for this system. 15 19 // // If the value is a list, the entries mus be of the form key=value, 16 20 // // where the last value takes precendence in the case of multiple
+4
pkg/tool/exec/exec.cue
··· 21 21 // cmd is the command to run. 22 22 cmd: string | [string, ...string] 23 23 24 + // dir specifies the working directory of the command. 25 + // The default is the current working directory. 26 + dir?: string 27 + 24 28 // env defines the environment variables to use for this system. 25 29 // If the value is a list, the entries mus be of the form key=value, 26 30 // where the last value takes precendence in the case of multiple
+2
pkg/tool/exec/exec.go
··· 137 137 138 138 cmd := exec.CommandContext(ctx.Context, bin, args...) 139 139 140 + cmd.Dir, _ = ctx.Obj.Lookup("dir").String() 141 + 140 142 env := ctx.Obj.Lookup("env") 141 143 142 144 // List case.
+3 -2
pkg/tool/exec/pkg.go
··· 20 20 Native: []*internal.Builtin{}, 21 21 CUE: `{ 22 22 Run: { 23 - $id: *"tool/exec.Run" | "exec" 24 - cmd: string | [string, ...string] 23 + $id: *"tool/exec.Run" | "exec" 24 + cmd: string | [string, ...string] 25 + dir?: string 25 26 env: { 26 27 [string]: string | [...=~"="] 27 28 }