You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: output.go
    path of file: ./repos/fx/docs/internal/exectest
    
    the code of the file until where you have to start completion: // Copyright (c) 2022 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of 
    
func StartWithOutput(t test.T, cmd *exec.Cmd) io.Reader {
	t.Helper()

	r, w, err := os.Pipe()
	require.NoError(t, err, "create pipe")

	cmd.Stdout = w
	cmd.Stderr = w
	require.NoError(t, cmd.Start(), "start command")
	// Close the output writer because this process won't write to it
	// anymore. Only the spawned process will.
	assert.NoError(t, w.Close(), "close output writer")
	t.Cleanup(func() {
		_, err := cmd.Process.Wait()
		assert.NoError(t, err, "wait for end")
		assert.NoError(t, r.Close(), "close output reader")
	})
	return r
}