| 238 | } |
| 239 | |
| 240 | func TestPipelineInterrupted(t *testing.T) { |
| 241 | if runtime.GOOS == "windows" { |
| 242 | t.Skip("FIXME: test skipped on Windows: 'sleep' unavailable") |
| 243 | } |
| 244 | |
| 245 | t.Parallel() |
| 246 | stdout := &bytes.Buffer{} |
| 247 | |
| 248 | p := pipe.New(pipe.WithStdout(stdout)) |
| 249 | p.Add(pipe.Command("sleep", "10")) |
| 250 | |
| 251 | ctx, cancel := context.WithTimeout(context.Background(), 20*time.Millisecond) |
| 252 | defer cancel() |
| 253 | |
| 254 | err := p.Start(ctx) |
| 255 | require.NoError(t, err) |
| 256 | |
| 257 | err = p.Wait() |
| 258 | assert.ErrorIs(t, err, context.DeadlineExceeded) |
| 259 | } |
| 260 | |
| 261 | func TestPipelineCanceled(t *testing.T) { |
| 262 | if runtime.GOOS == "windows" { |