container/params: pass fd instead of file
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m9s
Test / Hakurei (push) Successful in 3m9s
Test / Hpkg (push) Successful in 4m12s
Test / Sandbox (race detector) (push) Successful in 4m29s
Test / Hakurei (race detector) (push) Successful in 5m6s
Test / Flake checks (push) Successful in 1m29s

The file is very difficult to stub. Pass fd instead as it is the value that is actually useful.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-08-23 00:16:46 +09:00
parent 1c692bfb79
commit ea1e3ebae9
5 changed files with 19 additions and 22 deletions

View File

@@ -25,7 +25,7 @@ func Setup(extraFiles *[]*os.File) (int, *gob.Encoder, error) {
}
// Receive retrieves setup fd from the environment and receives params.
func Receive(key string, e any, v **os.File) (func() error, error) {
func Receive(key string, e any, fdp *uintptr) (func() error, error) {
var setup *os.File
if s, ok := os.LookupEnv(key); !ok {
@@ -38,8 +38,8 @@ func Receive(key string, e any, v **os.File) (func() error, error) {
if setup == nil {
return nil, syscall.EBADF
}
if v != nil {
*v = setup
if fdp != nil {
*fdp = setup.Fd()
}
}
}