MCPcopy Create free account
hub / github.com/aitjcize/Overlord / setupShellEnvironment

Method setupShellEnvironment

overlord/ghost.go:1253–1269  ·  view source on GitHub ↗

Helper functions for SpawnShellServer

()

Source from the content-addressed store, hash-verified

1251
1252// Helper functions for SpawnShellServer
1253func (ghost *Ghost) setupShellEnvironment() {
1254 // Execute shell command from HOME directory
1255 home := os.Getenv("HOME")
1256 if home == "" {
1257 home = "/tmp"
1258 }
1259 if err := os.Chdir(home); err != nil {
1260 log.Printf("Failed to change directory to %s: %v", home, err)
1261 }
1262
1263 // Add ghost executable to PATH
1264 exePath, err := os.Executable()
1265 if err == nil {
1266 os.Setenv("PATH", fmt.Sprintf("%s:%s", os.Getenv("PATH"),
1267 filepath.Dir(exePath)))
1268 }
1269}
1270
1271func (ghost *Ghost) setupShellCommand(stopConn chan struct{}) (*exec.Cmd, io.WriteCloser, error) {
1272 cmd := exec.Command(defaultShell, "-c", ghost.shellCommand)

Callers 1

SpawnShellServerMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected