MCPcopy
hub / github.com/github/git-sizer / TestIgnoredSIGPIPE

Function TestIgnoredSIGPIPE

internal/pipe/pipeline_test.go:334–352  ·  view source on GitHub ↗

Verify the correct error if one command in the pipeline exits before reading all of its predecessor's output. Note that the amount of unread output in this case *does not fit* within the OS-level pipe buffer.

(t *testing.T)

Source from the content-addressed store, hash-verified

332// amount of unread output in this case *does not fit* within the
333// OS-level pipe buffer.
334func TestIgnoredSIGPIPE(t *testing.T) {
335 if runtime.GOOS == "windows" {
336 t.Skip("FIXME: test skipped on Windows: 'seq' unavailable")
337 }
338
339 t.Parallel()
340
341 p := pipe.New()
342 p.Add(
343 pipe.IgnoreError(pipe.Command("seq", "100000"), pipe.IsSIGPIPE),
344 pipe.Command("echo", "foo"),
345 )
346
347 ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
348 defer cancel()
349 out, err := p.Output(ctx)
350 assert.NoError(t, err)
351 assert.EqualValues(t, "foo\n", out)
352}
353
354func TestFunction(t *testing.T) {
355 t.Parallel()

Callers

nothing calls this directly

Calls 5

NewFunction · 0.92
IgnoreErrorFunction · 0.92
CommandFunction · 0.92
OutputMethod · 0.80
AddMethod · 0.65

Tested by

no test coverage detected