mirror of
https://github.com/containers/podman.git
synced 2025-10-17 19:24:04 +08:00
Add and use libpod/Container.Terminal() helper
This just gets ctr.config.Spec.Process.Terminal with some null checks, allowing several places that open-coded this to use the helper. In particular, this helps the code in pkg/domain/infra/abi/terminal.StartAttachCtr(), that used to do: `ctr.Spec().Process.Terminal`, which looks fine, but actually causes a deep json copy in the `ctr.Spec()` call that takes over 3 msec. [NO NEW TESTS NEEDED] Just minor performance effects Signed-off-by: Alexander Larsson <alexl@redhat.com>
This commit is contained in:
@ -680,6 +680,14 @@ func (c *Container) WorkingDir() string {
|
||||
return "/"
|
||||
}
|
||||
|
||||
// Terminal returns true if the container has a terminal
|
||||
func (c *Container) Terminal() bool {
|
||||
if c.config.Spec != nil && c.config.Spec.Process != nil {
|
||||
return c.config.Spec.Process.Terminal
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// State Accessors
|
||||
// Require locking
|
||||
|
||||
|
Reference in New Issue
Block a user