diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-03-08 23:24:39 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-03-09 17:22:31 +0900 |
| commit | 61e58aa14da2f9ce45b49d38b889a00ef5a3b1d1 (patch) | |
| tree | 1c79e6e492f27535ebd53a3e76663c3f0eda3755 /helper | |
| parent | 9e15898c8f87f3c9eaf9e607fc5c860d91d48912 (diff) | |
helper/proc: expose setup file
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'helper')
| -rw-r--r-- | helper/proc/fd.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/helper/proc/fd.go b/helper/proc/fd.go index e99abb38..abf8f36a 100644 --- a/helper/proc/fd.go +++ b/helper/proc/fd.go @@ -25,7 +25,7 @@ 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) { +func Receive(key string, e any, v **os.File) (func() error, error) { var setup *os.File if s, ok := os.LookupEnv(key); !ok { @@ -38,8 +38,11 @@ func Receive(key string, e any) (func() error, error) { if setup == nil { return nil, ErrInvalid } + if v != nil { + *v = setup + } } } - return func() error { return setup.Close() }, gob.NewDecoder(setup).Decode(e) + return setup.Close, gob.NewDecoder(setup).Decode(e) } |
