The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7447

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From 0017346306c917cfc93035dc6382a917d17ed437 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Tue, 26 May 2020 20:54:32 -0400
Subject: [PATCH] shared/subprocess: Fix Stop handling
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 shared/subprocess/proc.go | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/shared/subprocess/proc.go b/shared/subprocess/proc.go
index b5caf41068..2ca1eca9a9 100644
--- a/shared/subprocess/proc.go
+++ b/shared/subprocess/proc.go
@@ -47,16 +47,20 @@ func (p *Process) Stop() error {
        if err == nil {
                err = pr.Kill()
                if err == nil {
+                       if p.hasMonitor {
+                               <-p.chExit
+                       }
+
                        return nil // Killed successfully.
                }
        }
 
-       if p.hasMonitor {
-               <-p.chExit
-       }
-
        // Check if either the existence check or the kill resulted in an 
already finished error.
        if strings.Contains(err.Error(), "process already finished") {
+               if p.hasMonitor {
+                       <-p.chExit
+               }
+
                return ErrNotRunning
        }
 
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to