Implemented running executables in memory
All checks were successful
/ test (push) Successful in 16s

This commit is contained in:
Eduard Urbach 2025-07-06 20:02:28 +02:00
parent e5aa006623
commit 5d39a13181
Signed by: akyoto
GPG key ID: 49226B848C78F6C8
10 changed files with 175 additions and 42 deletions

29
src/memfile/Exec_other.go Normal file
View file

@ -0,0 +1,29 @@
//go:build !linux
package memfile
import (
"os"
"os/exec"
)
// Exec executes an in-memory file.
func Exec(file *os.File) error {
err := file.Chmod(0o700)
if err != nil {
return err
}
err = file.Close()
if err != nil {
return err
}
cmd := exec.Command(file.Name())
cmd.Stdout = os.Stdout
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
return cmd.Run()
}