int/linux: add/use Exec

Drop the libcontainer/system/exec, and use the linux.Exec instead.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2025-03-25 14:41:41 -07:00
parent 431b8bb4d8
commit c690b66d7f
4 changed files with 15 additions and 11 deletions

View File

@@ -6,6 +6,17 @@ import (
"golang.org/x/sys/unix"
)
// Exec wraps [unix.Exec].
func Exec(cmd string, args []string, env []string) error {
err := retryOnEINTR(func() error {
return unix.Exec(cmd, args, env)
})
if err != nil {
return &os.PathError{Op: "exec", Path: cmd, Err: err}
}
return nil
}
// Getwd wraps [unix.Getwd].
func Getwd() (wd string, err error) {
wd, err = retryOnEINTR2(unix.Getwd)