diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-01-15 23:39:51 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-01-15 23:39:51 +0900 |
| commit | 124743ffd3da7c31ef9c562593e15d88bb19008e (patch) | |
| tree | 96ff77ad18f17859cf4a050f2fda23f93610edc2 /internal/proc | |
| parent | be4d8b63009fd63fdd30e89b0d1a3f198b10e408 (diff) | |
app: expose single run method
App is no longer just a simple [exec.Cmd] wrapper, so exposing these steps separately no longer makes sense and actually hinders proper error handling, cleanup and cancellation. This change removes the five-second wait when the shim dies before receiving the payload, and provides caller the ability to gracefully stop execution of the confined process.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/proc')
| -rw-r--r-- | internal/proc/fd.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/proc/fd.go b/internal/proc/fd.go index 5400abe9..e99abb38 100644 --- a/internal/proc/fd.go +++ b/internal/proc/fd.go @@ -12,6 +12,7 @@ var ( ErrInvalid = errors.New("bad file descriptor") ) +// Setup appends the read end of a pipe for payload transmission and returns its fd. func Setup(extraFiles *[]*os.File) (int, *gob.Encoder, error) { if r, w, err := os.Pipe(); err != nil { return -1, nil, err @@ -22,6 +23,8 @@ func Setup(extraFiles *[]*os.File) (int, *gob.Encoder, error) { } } +// Receive retrieves payload pipe fd from the environment, +// receives its payload and returns the Close method of the pipe. func Receive(key string, e any) (func() error, error) { var setup *os.File |
