|
@@ -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 {
|
|
|
|
- if !tty || system.GetOSVersion().Build >= 14350 {
|
|
|
|
|
|
+func fixStdinBackspaceBehavior(w io.WriteCloser, osversion string, tty bool) io.WriteCloser {
|
|
|
|
+ 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}
|
|
}
|
|
}
|
|
|
|
|