Skip to content

Commit

Permalink
add context to ZencodeExecExtra
Browse files Browse the repository at this point in the history
  • Loading branch information
albertolerda authored and jaromil committed Aug 14, 2023
1 parent 49a6d34 commit 362981f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions bindings/golang/zenroom/zenroom.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ type ZenResult struct {
Logs string;
}
func ZencodeExec(script string, conf string, keys string, data string) (ZenResult, bool) {
return ZencodeExecExtra(script, conf, keys, data, "")
return ZencodeExecExtra(script, conf, keys, data, "", "")
}

func ZencodeExecExtra(script string, conf string, keys string, data string, extra string) (ZenResult, bool) {
func ZencodeExecExtra(script string, conf string, keys string, data string, extra string, context string) (ZenResult, bool) {
execCmd := exec.Command("zencode-exec")

stdout, err := execCmd.StdoutPipe()
Expand Down Expand Up @@ -56,7 +56,8 @@ func ZencodeExecExtra(script string, conf string, keys string, data string, extr
io.WriteString(stdin, b64extra)
io.WriteString(stdin, "\n")

// context
b64context := b64.StdEncoding.EncodeToString([]byte(context))
io.WriteString(stdin, b64context)
io.WriteString(stdin, "\n")

err = execCmd.Start()
Expand Down
2 changes: 1 addition & 1 deletion bindings/golang/zenroom/zenroom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Given I have a 'string' named 'data'
Given I have a 'string' named 'extra'
Then print data
`
res, success := ZencodeExecExtra(script, "", `{"keys": "keys"}`, `{"data": "data"}`, `{"extra": "extra"}`)
res, success := ZencodeExecExtra(script, "", `{"keys": "keys"}`, `{"data": "data"}`, `{"extra": "extra"}`, "")
if !success {
t.Error(res.Logs)
}
Expand Down

0 comments on commit 362981f

Please sign in to comment.