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