sandbox: check command function pointer
All checks were successful
Test / Create distribution (push) Successful in 25s
Test / Fortify (push) Successful in 2m37s
Test / Fpkg (push) Successful in 3m25s
Test / Data race detector (push) Successful in 3m59s
Test / Flake checks (push) Successful in 55s

Setting default CommandContext on initialisation is somewhat of a footgun.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-03-16 23:29:14 +09:00
parent 42de09e896
commit 48feca800f
2 changed files with 9 additions and 11 deletions

View File

@@ -26,16 +26,13 @@ func ExecFilter(ctx context.Context,
c, cancel := context.WithTimeout(ctx, lddTimeout)
defer cancel()
container := sandbox.New(c, "ldd", p)
container.CommandContext = commandContext
container.Hostname = "fortify-ldd"
stdout, stderr := new(bytes.Buffer), new(bytes.Buffer)
container.Stdout = stdout
container.Stderr = stderr
container.Bind("/", "/", 0).Dev("/dev")
if commandContext != nil {
container.CommandContext = commandContext
}
if err := container.Start(); err != nil {
return nil, err
} else if err = container.Serve(); err != nil {