Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,9 @@ func (c *Client) Start() (addr net.Addr, err error) {
cmd := c.config.Cmd
cmd.Env = append(cmd.Env, os.Environ()...)
cmd.Env = append(cmd.Env, env...)
cmd.Stdin = os.Stdin
if cmd.Stdin == nil {
cmd.Stdin = os.Stdin
}

cmdStdout, err := cmd.StdoutPipe()
if err != nil {
Expand Down
27 changes: 27 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,34 @@ func TestClient_Stdin(t *testing.T) {
t.Fatal("process didn't exit cleanly")
}
}
func TestClient_StdinBuffer(t *testing.T) {
Comment on lines 821 to +822
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
func TestClient_StdinBuffer(t *testing.T) {
}
func TestClient_StdinBuffer(t *testing.T) {


process := helperProcess("stdin")
process.Stdin = bytes.NewBufferString("hello")
c := NewClient(&ClientConfig{
Cmd: process,
HandshakeConfig: testHandshake,
Plugins: testPluginMap,
})
defer c.Kill()

_, err := c.Start()
if err != nil {
t.Fatalf("error: %s", err)
}

for {
if c.Exited() {
break
}

time.Sleep(50 * time.Millisecond)
}

if !process.ProcessState.Success() {
t.Fatal("process didn't exit cleanly")
}
}
func TestClient_SecureConfig(t *testing.T) {
Comment on lines +849 to 850
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
func TestClient_SecureConfig(t *testing.T) {
}
func TestClient_SecureConfig(t *testing.T) {

// Test failure case
secureConfig := &SecureConfig{
Expand Down