Skip to content

Commit c6ed652

Browse files
committed
fix: make GPTSCRIPT_BIN relative to clicky-serves binary
Signed-off-by: Donnie Adams <[email protected]>
1 parent 3bdb4be commit c6ed652

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

exec.go

+2-8
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"encoding/json"
77
"fmt"
88
"io"
9-
"log/slog"
109
"os"
1110
"os/exec"
1211
"path/filepath"
@@ -314,16 +313,11 @@ func concatTools(tools []fmt.Stringer) string {
314313

315314
func getCommand() string {
316315
if gptScriptBin := os.Getenv("GPTSCRIPT_BIN"); gptScriptBin != "" {
317-
if filepath.IsAbs(gptScriptBin) {
318-
return gptScriptBin
319-
}
320-
cwd, err := os.Getwd()
321-
if err != nil {
322-
slog.Warn("failed to get cwd", "err", err.Error())
316+
if filepath.IsAbs(gptScriptBin) || len(os.Args) == 0 {
323317
return gptScriptBin
324318
}
325319

326-
return filepath.Join(cwd, gptScriptBin)
320+
return filepath.Join(filepath.Dir(os.Args[0]), gptScriptBin)
327321
}
328322

329323
return "gptscript"

0 commit comments

Comments
 (0)