-
Notifications
You must be signed in to change notification settings - Fork 949
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
bugfix: align with docker v1.24 API #1226
bugfix: align with docker v1.24 API #1226
Conversation
defer func() { | ||
if err := restoreMode(in, out); err != nil { | ||
fmt.Fprintf(os.Stderr, "failed to restore term mode") | ||
if e.Terminal { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the command doesn't set tty, we don't need to set raw mode for terminal
@@ -493,6 +493,12 @@ | |||
"revision": "53a58da551e961b3710bbbdfabbc162c3f5f30f6", | |||
"revisionTime": "2018-01-31T23:13:00Z" | |||
}, | |||
{ | |||
"checksumSHA1": "H1rrbVmeE1z2TnkF7tSrfh+qUOY=", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we let docker vendor pkg version be same ? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HusterWan Yes. It's already "53a58da551e961b3710bbbdfabbc162c3f5f30f6"
@@ -95,19 +96,26 @@ func (e *ExecCommand) runExec(args []string) error { | |||
wg.Add(1) | |||
go func() { | |||
defer wg.Done() | |||
io.Copy(os.Stdout, reader) | |||
if !e.Terminal { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add some test case for exec
command -i
and -it
flags
we can add the test case later, because this feature is needed very hurry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure thing.
The docker exec api uses custom stream bytes if the tty is false. In order to align with docker API, we need to use github.com/docker/docker/pkg/stdcopy package to modify stream bytes. In order to make the cri CI happy, we should skip the related `echo` test. Signed-off-by: Wei Fu <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #1226 +/- ##
==========================================
- Coverage 15.37% 15.36% -0.02%
==========================================
Files 172 172
Lines 10619 10629 +10
==========================================
Hits 1633 1633
- Misses 8866 8876 +10
Partials 120 120
|
LGTM |
The docker exec api uses custom stream bytes if the tty is false.
In order to align with docker API, we need to use
github.com/docker/docker/pkg/stdcopy package to modify stream bytes.
Signed-off-by: Wei Fu [email protected]
Ⅰ. Describe what this PR did
Align with docker v1.24 API. As we known, the docker API has custom stream bytes when the client doesn't set tty. More information is here: https://github.com/moby/moby/blob/master/client/container_attach.go#L10-L33
Ⅱ. Does this pull request fix one issue?
Fix #1221
Ⅲ. Describe how you did it
use
github.com/docker/docker/pkg/stdcopy
to wrap theio.Writer
.Ⅳ. Describe how to verify it
after fix:
Ⅴ. Special notes for reviews
@allencloud @HusterWan @yyb196 This change is not ideal. We need to refactor the IO related things.