mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #23000 from jstarks/use_image_version_for_console_check
Windows: Use image version, not OS version for TTY fixup
This commit is contained in:
commit
089166ebe2
5 changed files with 19 additions and 5 deletions
|
@ -34,6 +34,8 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e
|
||||||
return nil, fmt.Errorf("Failed to graph.Get on ImageID %s - %s", c.ImageID, err)
|
return nil, fmt.Errorf("Failed to graph.Get on ImageID %s - %s", c.ImageID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.Platform.OSVersion = img.OSVersion
|
||||||
|
|
||||||
// In base spec
|
// In base spec
|
||||||
s.Hostname = c.FullHostname()
|
s.Hostname = c.FullHostname()
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ func (clnt *client) AddProcess(containerID, processFriendlyName string, procToAd
|
||||||
iopipe.Stdin = createStdInCloser(stdin, newProcess)
|
iopipe.Stdin = createStdInCloser(stdin, newProcess)
|
||||||
|
|
||||||
// TEMP: Work around Windows BS/DEL behavior.
|
// TEMP: Work around Windows BS/DEL behavior.
|
||||||
iopipe.Stdin = fixStdinBackspaceBehavior(iopipe.Stdin, procToAdd.Terminal)
|
iopipe.Stdin = fixStdinBackspaceBehavior(iopipe.Stdin, container.ociSpec.Platform.OSVersion, procToAdd.Terminal)
|
||||||
|
|
||||||
// Convert io.ReadClosers to io.Readers
|
// Convert io.ReadClosers to io.Readers
|
||||||
if stdout != nil {
|
if stdout != nil {
|
||||||
|
|
|
@ -106,7 +106,7 @@ func (ctr *container) start() error {
|
||||||
iopipe.Stdin = createStdInCloser(stdin, hcsProcess)
|
iopipe.Stdin = createStdInCloser(stdin, hcsProcess)
|
||||||
|
|
||||||
// TEMP: Work around Windows BS/DEL behavior.
|
// TEMP: Work around Windows BS/DEL behavior.
|
||||||
iopipe.Stdin = fixStdinBackspaceBehavior(iopipe.Stdin, ctr.ociSpec.Process.Terminal)
|
iopipe.Stdin = fixStdinBackspaceBehavior(iopipe.Stdin, ctr.ociSpec.Platform.OSVersion, ctr.ociSpec.Process.Terminal)
|
||||||
|
|
||||||
// Convert io.ReadClosers to io.Readers
|
// Convert io.ReadClosers to io.Readers
|
||||||
if stdout != nil {
|
if stdout != nil {
|
||||||
|
|
|
@ -2,9 +2,10 @@ package libcontainerd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/Microsoft/hcsshim"
|
"github.com/Microsoft/hcsshim"
|
||||||
"github.com/docker/docker/pkg/system"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// process keeps the state for both main container process and exec process.
|
// process keeps the state for both main container process and exec process.
|
||||||
|
@ -33,10 +34,19 @@ func openReaderFromPipe(p io.ReadCloser) io.Reader {
|
||||||
// fixStdinBackspaceBehavior works around a bug in Windows before build 14350
|
// fixStdinBackspaceBehavior works around a bug in Windows before build 14350
|
||||||
// where it interpreted DEL as VK_DELETE instead of as VK_BACK. This replaces
|
// where it interpreted DEL as VK_DELETE instead of as VK_BACK. This replaces
|
||||||
// DEL with BS to work around this.
|
// DEL with BS to work around this.
|
||||||
func fixStdinBackspaceBehavior(w io.WriteCloser, tty bool) io.WriteCloser {
|
func fixStdinBackspaceBehavior(w io.WriteCloser, osversion string, tty bool) io.WriteCloser {
|
||||||
if !tty || system.GetOSVersion().Build >= 14350 {
|
if !tty {
|
||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
|
v := strings.Split(osversion, ".")
|
||||||
|
if len(v) < 3 {
|
||||||
|
return w
|
||||||
|
}
|
||||||
|
|
||||||
|
if build, err := strconv.Atoi(v[2]); err != nil || build >= 14350 {
|
||||||
|
return w
|
||||||
|
}
|
||||||
|
|
||||||
return &delToBsWriter{w}
|
return &delToBsWriter{w}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,8 @@ type Platform struct {
|
||||||
OS string `json:"os"`
|
OS string `json:"os"`
|
||||||
// Arch is the architecture
|
// Arch is the architecture
|
||||||
Arch string `json:"arch"`
|
Arch string `json:"arch"`
|
||||||
|
// OSVersion is the version of the operating system.
|
||||||
|
OSVersion string `json:"os.version,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mount specifies a mount for a container.
|
// Mount specifies a mount for a container.
|
||||||
|
|
Loading…
Add table
Reference in a new issue