Skip to content
Snippets Groups Projects
Commit 34c542f3 authored by Anand Patil's avatar Anand Patil
Browse files

systemd-docker client detaches if user provides -d option

parent faf1c44d
No related branches found
No related tags found
No related merge requests found
...@@ -43,6 +43,7 @@ type Context struct { ...@@ -43,6 +43,7 @@ type Context struct {
Pid int Pid int
PidFile string PidFile string
Client *dockerClient.Client Client *dockerClient.Client
Detach bool
} }
func setupEnvironment(c *Context) { func setupEnvironment(c *Context) {
...@@ -131,6 +132,7 @@ func parseContext(args []string) (*Context, error) { ...@@ -131,6 +132,7 @@ func parseContext(args []string) (*Context, error) {
c.NotifySocket = os.Getenv("NOTIFY_SOCKET") c.NotifySocket = os.Getenv("NOTIFY_SOCKET")
c.Args = newArgs c.Args = newArgs
c.Cgroups = flCgroups.GetAll() c.Cgroups = flCgroups.GetAll()
c.Detach = foundD
for _, val := range c.Cgroups { for _, val := range c.Cgroups {
if val == "all" { if val == "all" {
...@@ -550,6 +552,7 @@ func mainWithArgs(args []string) (*Context, error) { ...@@ -550,6 +552,7 @@ func mainWithArgs(args []string) (*Context, error) {
return c, err return c, err
} }
if !c.Detach {
go pipeLogs(c) go pipeLogs(c)
err = keepAlive(c) err = keepAlive(c)
...@@ -561,6 +564,7 @@ func mainWithArgs(args []string) (*Context, error) { ...@@ -561,6 +564,7 @@ func mainWithArgs(args []string) (*Context, error) {
if err != nil { if err != nil {
return c, err return c, err
} }
}
return c, nil return c, nil
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment