-
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: can't allow exec attach ttyMode container from a non-tty client #2351
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2351 +/- ##
=========================================
+ Coverage 63.62% 68.03% +4.4%
=========================================
Files 265 265
Lines 18213 18213
=========================================
+ Hits 11588 12391 +803
+ Misses 5342 4401 -941
- Partials 1283 1421 +138
|
test/cli_exec_test.go
Outdated
// TestExecWithTty tests running container with -tty flag and attach stdin in a non-tty client. | ||
func (suite *PouchExecSuite) TestExecWithTty(c *check.C) { | ||
name := "TestExecWithTty" | ||
res := command.PouchRun("run", "-d", "--name", name, busyboxImage, "sleep", "100000") |
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.
it's just nit. could we use one line to check command.PouchRun("run", "-d", "--name", name, busyboxImage, "sleep", "100000").Assert(c, icmd.Success)
? thanks.
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.
Done.
fdd3d2d
to
4783fff
Compare
cli/exec.go
Outdated
@@ -77,6 +77,10 @@ func (e *ExecCommand) runExec(args []string) error { | |||
Env: e.Envs, | |||
} | |||
|
|||
if err := checkTty(createExecConfig.AttachStdin, createExecConfig.Tty, os.Stdout.Fd()); err != nil { |
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 it should be os.Stdin.Fd() here.
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.
updated.
Signed-off-by: zhangyue <[email protected]>
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.
LGTM
Signed-off-by: zhangyue [email protected]
Ⅰ. Describe what this PR did
fix the same issue with pr #2338
Ⅱ. Does this pull request fix one issue?
fix the same issue with pr #2338
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
add TestExecWithTty testcase.
Ⅳ. Describe how to verify it
None.
Ⅴ. Special notes for reviews
None.