RunInFS synchronously runs fn in the context of the container filesystem and passes through its return value. The container filesystem is only visible to functions called in the same goroutine as fn. Goroutines started from fn will see the host's filesystem.
(ctx context.Context, fn func() error)
| 232 | // The container filesystem is only visible to functions called in the same |
| 233 | // goroutine as fn. Goroutines started from fn will see the host's filesystem. |
| 234 | func (vw *containerFSView) RunInFS(ctx context.Context, fn func() error) error { |
| 235 | res := make(chan error) |
| 236 | select { |
| 237 | case vw.todo <- future{fn: fn, res: res}: |
| 238 | case <-ctx.Done(): |
| 239 | return ctx.Err() |
| 240 | } |
| 241 | return <-res |
| 242 | } |
| 243 | |
| 244 | // GoInFS starts fn in the container FS. It blocks until fn is started but does |
| 245 | // not wait until fn returns. An error is returned if ctx is canceled before fn |
no test coverage detected