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

drop stdin for exec sync #750

Merged
Merged
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
1 change: 0 additions & 1 deletion conmon-rs/common/proto/conmon.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ interface Conmon {
timeoutSec @1 :UInt64;
command @2 :List(Text);
terminal @3 :Bool;
stdin @4 :Bool;
Copy link
Member

Choose a reason for hiding this comment

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

It also has to be removed from the client.go

}

struct ExecSyncContainerResponse {
Expand Down
3 changes: 1 addition & 2 deletions conmon-rs/server/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,11 @@ impl conmon::Server for Server {

let command = pry!(req.get_command());
let args = pry_err!(self.generate_exec_sync_args(&id, &pidfile, &container_io, &command));
let stdin = req.get_stdin();

Promise::from_future(
async move {
match child_reaper
.create_child(&runtime, &args, stdin, &mut container_io, &pidfile)
.create_child(&runtime, &args, false, &mut container_io, &pidfile)
.await
{
Ok((grandchild_pid, token)) => {
Expand Down
285 changes: 138 additions & 147 deletions internal/proto/conmon.capnp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -666,9 +666,6 @@ type ExecSyncConfig struct {

// Terminal specifies if a tty should be used.
Terminal bool

// Stdin indicates if stdin should be available or not.
Stdin bool
}

// ExecContainerResult is the result for calling the ExecSyncContainer method.
Expand Down Expand Up @@ -709,7 +706,6 @@ func (c *ConmonClient) ExecSyncContainer(ctx context.Context, cfg *ExecSyncConfi
return err
}
req.SetTerminal(cfg.Terminal)
req.SetStdin(cfg.Stdin)
Copy link
Member

@saschagrunert saschagrunert Sep 22, 2022

Choose a reason for hiding this comment

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

I’d say we drop it from the cfg type as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🙃 good catch

Copy link
Member

Choose a reason for hiding this comment

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

Ah the tests have to be fixed as well.

if err := p.SetRequest(req); err != nil {
return fmt.Errorf("set request: %w", err)
}
Expand Down
6 changes: 0 additions & 6 deletions pkg/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ var _ = Describe("ConmonClient", func() {
ID: tr.ctrID,
Command: []string{"/busybox", "echo", "-n", "hello", "world", fmt.Sprintf("%d", i)},
Terminal: terminal,
Stdin: true,
Timeout: timeoutUnlimited,
})
Expect(err).To(BeNil())
Expand Down Expand Up @@ -301,7 +300,6 @@ var _ = Describe("ConmonClient", func() {
ID: tr.ctrID,
Command: []string{"/busybox", "echo", "-n", "hello", "world", fmt.Sprintf("%d", i)},
Terminal: terminal,
Stdin: true,
Timeout: timeoutUnlimited,
})

Expand Down Expand Up @@ -333,7 +331,6 @@ var _ = Describe("ConmonClient", func() {
ID: tr.ctrID,
Command: []string{"/busybox", "echo", "-n", "hello", "world"},
Timeout: timeoutUnlimited,
Stdin: true,
Terminal: terminal,
})

Expand Down Expand Up @@ -362,7 +359,6 @@ var _ = Describe("ConmonClient", func() {
Command: []string{"/busybox", "echo", "-n", "hello", "world"},
Timeout: 10,
Terminal: terminal,
Stdin: true,
})

Expect(err).To(BeNil())
Expand All @@ -383,7 +379,6 @@ var _ = Describe("ConmonClient", func() {
Command: []string{"/busybox", "invalid"},
Timeout: timeoutUnlimited,
Terminal: terminal,
Stdin: true,
})

Expect(err).To(BeNil())
Expand Down Expand Up @@ -414,7 +409,6 @@ var _ = Describe("ConmonClient", func() {
Command: []string{"/busybox", "sleep", "5"},
Timeout: 3,
Terminal: terminal,
Stdin: true,
})

Expect(err).To(BeNil())
Expand Down