| 201 | t.Fatalf("parent-cancel must not be reported as timeout: %q", out) |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | func TestBashBackgroundedChildDoesNotBlock(t *testing.T) { |
| 206 | // A naked `cmd &` leaves the child holding stdout/stderr pipes. We must not |
| 207 | // block on them after /bin/sh exits, which caused multi-minute stalls |
| 208 | // before WaitDelay was set. |
| 209 | start := time.Now() |
| 210 | Bash(context.Background(), "sleep 3 &", 5*time.Second) |
| 211 | if elapsed := time.Since(start); elapsed > 500*time.Millisecond { |
| 212 | t.Fatalf("bash blocked for %s on backgrounded child's pipes; want <500ms", elapsed) |
| 213 | } |
| 214 | } |
| 215 | |