Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions _demo/commandrun/commandrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package main
import (
"bytes"
"os/exec"
"path/filepath"
)

func main() {
var data bytes.Buffer
cmd := exec.Command("echo", "hello llgo")
cmd.Dir = filepath.Dir("./")
cmd.Stdout = &data
err := cmd.Run()
if err != nil {
Expand Down
7 changes: 2 additions & 5 deletions runtime/internal/lib/syscall/exec_libc2.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,10 @@ func forkAndExecInChild(argv0 *c.Char, argv, envv **c.Char, chroot, dir *c.Char,

// Chdir
if dir != nil {
/* TODO(xsw):
_, _, err1 = rawSyscall(abi.FuncPCABI0(libc_chdir_trampoline), uintptr(unsafe.Pointer(dir)), 0, 0)
if err1 != 0 {
if ret := os.Chdir(dir); ret < 0 {
err1 = Errno(os.Errno())
goto childerror
}
*/
panic("todo: syscall.forkAndExecInChild - dir")
}

// Pass 1: look for fd[i] < i and move those up above len(fd)
Expand Down
7 changes: 2 additions & 5 deletions runtime/internal/lib/syscall/exec_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,13 +582,10 @@ func forkAndExecInChild1(argv0 *c.Char, argv, envv **c.Char, chroot, dir *c.Char

// Chdir
if dir != nil {
/**
_, _, err1 = RawSyscall(syscall.SYS_CHDIR, uintptr(unsafe.Pointer(dir)), 0, 0)
if err1 != 0 {
if ret := os.Chdir(dir); ret < 0 {
err1 = Errno(os.Errno())
goto childerror
}
*/
panic("todo: syscall.forkAndExecInChild1 - dir")
}

// Parent death signal
Expand Down
Loading