helper/proc: expose setup file
All checks were successful
Test / Create distribution (push) Successful in 25s
Test / Fortify (push) Successful in 2m34s
Test / Fpkg (push) Successful in 3m29s
Test / Data race detector (push) Successful in 3m27s
Test / Flake checks (push) Successful in 51s

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-03-08 23:24:39 +09:00
parent 9e15898c8f
commit 61e58aa14d
5 changed files with 28 additions and 26 deletions

View File

@@ -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)
}