Skip to content

reuse same code for setting pipes in run/exec#12659

Merged
crosbymichael merged 1 commit intomoby:masterfrom
dqminh:exec-interactive-hang
Apr 23, 2015
Merged

reuse same code for setting pipes in run/exec#12659
crosbymichael merged 1 commit intomoby:masterfrom
dqminh:exec-interactive-hang

Conversation

@dqminh
Copy link
Copy Markdown
Contributor

@dqminh dqminh commented Apr 22, 2015

Fixes #12546

The command's stdin pipe has to be an *os.File, otherwise bad things happen. This tries to reuse some code of run to setup the pipes because run code path already took care of that.

@LK4D4
Copy link
Copy Markdown
Contributor

LK4D4 commented Apr 23, 2015

LGTM
Thanks

@dqminh
Copy link
Copy Markdown
Contributor Author

dqminh commented Apr 23, 2015

@cpuguy83 posted some test code here https://gist.github.com/cpuguy83/b98f4da1207b9b4ed82b and this has not passed his test yet. I'm still finding out why.

@dqminh
Copy link
Copy Markdown
Contributor Author

dqminh commented Apr 23, 2015

@LK4D4 @cpuguy83 i added a test that simulates the case better. It creates a pty and set that as stdin/out/err of the command ( so it behaves similar to starting the command inside a term ). The exec test then fails without the fix, and passes with it.

Comment thread integration-cli/docker_cli_exec_test.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is causing a failure on Windows... but seems like something we should be testing on Windows too.

cc @ahmetalpbalkan

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We extracted tests that has kr/pty into _unix.go files b/c pty does a lot of unix stuff to control the terminal and none of those stuff exists on windows (pkg doesnt even compile on windows). I don't think we can easily run kr/pty on windows @cpuguy83 but folks working on engine may come up with a solution there.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we don't have a way to do this today (even not using kr/pty), then yeah, let's move to _unix.go

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i will move this to _unix.go first, just to make sure that it passes the current CI tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks to me like this test can be written without kr/pty using exec.Cmd.

@dqminh dqminh force-pushed the exec-interactive-hang branch from 2e823ce to d3883e4 Compare April 23, 2015 19:25
This also moves `exec -i` test to _unix_test.go because it seems to need a
pty to reliably reproduce the behavior.

Signed-off-by: Daniel, Dao Quang Minh <[email protected]>
@dqminh dqminh force-pushed the exec-interactive-hang branch from d3883e4 to ade8146 Compare April 23, 2015 22:46
@cpuguy83
Copy link
Copy Markdown
Member

LGTM

1 similar comment
@crosbymichael
Copy link
Copy Markdown
Contributor

LGTM

crosbymichael added a commit that referenced this pull request Apr 23, 2015
reuse same code for setting pipes in run/exec
@crosbymichael crosbymichael merged commit c26695c into moby:master Apr 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docker exec -i hangs after command has exited

7 participants