buildlet: add Dir option to ExecOpts
Change-Id: I74168786d2fd77d281c18a5fdf3f2321dfd109b8
Reviewed-on: https://go-review.googlesource.com/4500
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/buildlet/buildletclient.go b/buildlet/buildletclient.go
index 1f88078..f178162 100644
--- a/buildlet/buildletclient.go
+++ b/buildlet/buildletclient.go
@@ -156,6 +156,11 @@
// If nil, the output is discarded.
Output io.Writer
+ // Dir is the directory from which to execute the command.
+ // It is optional. If not specified, it defaults to the directory of
+ // the command, or the work directory if SystemLevel is set.
+ Dir string
+
// Args are the arguments to pass to the cmd given to Client.Exec.
Args []string
@@ -192,6 +197,7 @@
form := url.Values{
"cmd": {cmd},
"mode": {mode},
+ "dir": {opts.Dir},
"cmdArg": opts.Args,
"env": opts.ExtraEnv,
"debug": {fmt.Sprint(opts.Debug)},