Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start the plugin using the configured stdin, if available #127

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
6 changes: 5 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,11 @@ 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

// Use the client's stdin if configured, otherwise fallback to os.stdin
if cmd.Stdin == nil {
cmd.Stdin = os.Stdin
}

cmdStdout, err := cmd.StdoutPipe()
if err != nil {
Expand Down
5 changes: 1 addition & 4 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,11 +728,8 @@ func TestClient_Stdin(t *testing.T) {
t.Fatalf("error: %s", err)
}

oldStdin := os.Stdin
defer func() { os.Stdin = oldStdin }()
os.Stdin = tf

process := helperProcess("stdin")
process.Stdin = tf
c := NewClient(&ClientConfig{
Cmd: process,
HandshakeConfig: testHandshake,
Expand Down