# testkit/testshell

> Package testshell finds native shells and synchronizes test commands with the tests that read their output.

<!-- Generated from the Go source of github.com/barevoidco/zelk/core/testkit/testshell (cmd/zelk/internal/reference TestReferenceGoAPI). Don't edit: change the code, then run make reference. -->

```go
import "github.com/barevoidco/zelk/core/testkit/testshell"
```

Package testshell finds native shells and synchronizes test commands with the tests that read their output.


## Path

```go
func Path(t *testing.T, environ func() []string) string
```

Path returns the native Bash executable or fails the test if Windows does not have Git for Windows installed.


## OutputSignals

```go
type OutputSignals struct {
	env.Environment
	// contains filtered or unexported fields
}
```

OutputSignals observes a test command's stdout checkpoints on its separate stderr stream. The command writes ! to stderr after each piece of stdout the test will read.


### NewOutputSignals

```go
func NewOutputSignals(e env.Environment, count int) *OutputSignals
```

NewOutputSignals wraps a test environment that will start one command with count stdout checkpoints.


### OutputSignals.Start

```go
func (s *OutputSignals) Start(ctx context.Context, cmd env.Cmd) (env.Proc, error)
```

Start connects the command's stderr to its checkpoints.


### OutputSignals.Wait

```go
func (s *OutputSignals) Wait(ctx context.Context) error
```

Wait waits for the next checkpoint without reading the command's stdout.


### OutputSignals.Write

```go
func (s *OutputSignals) Write(p []byte) (int, error)
```

Write delivers checkpoint bytes without blocking the process's stderr copier.
