@@ -17,7 +17,7 @@ import (
17
17
"strings"
18
18
"sync"
19
19
20
- "github.com/google/shlex "
20
+ "github.com/buildkite/shellwords "
21
21
"github.com/gptscript-ai/gptscript/pkg/counter"
22
22
"github.com/gptscript-ai/gptscript/pkg/env"
23
23
"github.com/gptscript-ai/gptscript/pkg/types"
@@ -118,7 +118,7 @@ func (e *Engine) runCommand(ctx Context, tool types.Tool, input string, toolCate
118
118
instructions = append (instructions , inputContext .Content )
119
119
}
120
120
121
- var extraEnv = []string {
121
+ extraEnv : = []string {
122
122
strings .TrimSpace ("GPTSCRIPT_CONTEXT=" + strings .Join (instructions , "\n " )),
123
123
}
124
124
cmd , stop , err := e .newCommand (ctx .Ctx , extraEnv , tool , input )
@@ -254,7 +254,7 @@ func (e *Engine) newCommand(ctx context.Context, extraEnv []string, tool types.T
254
254
interpreter , rest , _ := strings .Cut (tool .Instructions , "\n " )
255
255
interpreter = strings .TrimSpace (interpreter )[2 :]
256
256
257
- args , err := shlex .Split (interpreter )
257
+ args , err := shellwords .Split (interpreter )
258
258
if err != nil {
259
259
return nil , nil , err
260
260
}
@@ -332,15 +332,15 @@ func replaceVariablesForInterpreter(interpreter string, envMap map[string]string
332
332
return envMap [s ]
333
333
})
334
334
// We protect newly resolved env vars from getting replaced when we do the second Expand
335
- // after shlex . Yeah, crazy. I'm guessing this isn't secure, but just trying to avoid a foot gun.
335
+ // after shellwords . Yeah, crazy. I'm guessing this isn't secure, but just trying to avoid a foot gun.
336
336
part = os .Expand (part , func (s string ) string {
337
337
return "${__" + s + "}"
338
338
})
339
339
}
340
340
parts = append (parts , part )
341
341
}
342
342
343
- parts , err := shlex .Split (strings .Join (parts , "" ))
343
+ parts , err := shellwords .Split (strings .Join (parts , "" ))
344
344
if err != nil {
345
345
return nil , err
346
346
}
0 commit comments