summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-02-13 22:55:52 +0100
committerGitHub <noreply@github.com>2019-02-13 22:55:52 +0100
commitdfc64e15d7f8b1715798fd68bd3ff74ae192b354 (patch)
tree28fff3097e5705623bc48670c67dee64a5296329 /utils
parent29d9ccf38158235ef37e4f5c20ad152bb396e3b9 (diff)
parent9d4e7fe58b10c4130340a151a377cf7be8aaa810 (diff)
downloadpodman-dfc64e15d7f8b1715798fd68bd3ff74ae192b354.tar.gz
podman-dfc64e15d7f8b1715798fd68bd3ff74ae192b354.tar.bz2
podman-dfc64e15d7f8b1715798fd68bd3ff74ae192b354.zip
Merge pull request #2319 from mheon/unconditional_cleanup
Fix manual detach from containers to not wait for exit
Diffstat (limited to 'utils')
-rw-r--r--utils/utils.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/utils/utils.go b/utils/utils.go
index c7c5ab5cf..4a91b304f 100644
--- a/utils/utils.go
+++ b/utils/utils.go
@@ -9,6 +9,7 @@ import (
systemdDbus "github.com/coreos/go-systemd/dbus"
"github.com/godbus/dbus"
+ "github.com/pkg/errors"
)
// ExecCmd executes a command with args and returns its output as a string along
@@ -82,12 +83,9 @@ func newProp(name string, units interface{}) systemdDbus.Property {
}
}
-// DetachError is special error which returned in case of container detach.
-type DetachError struct{}
-
-func (DetachError) Error() string {
- return "detached from container"
-}
+// ErrDetach is an error indicating that the user manually detached from the
+// container.
+var ErrDetach = errors.New("detached from container")
// CopyDetachable is similar to io.Copy but support a detach key sequence to break out.
func CopyDetachable(dst io.Writer, src io.Reader, keys []byte) (written int64, err error) {
@@ -108,7 +106,7 @@ func CopyDetachable(dst io.Writer, src io.Reader, keys []byte) (written int64, e
}
if i == len(keys)-1 {
// src.Close()
- return 0, DetachError{}
+ return 0, ErrDetach
}
nr, er = src.Read(buf)
}