From 25fb6394652ef98e850fdfb3fc89999bb5ff6b6c Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Fri, 30 Aug 2019 03:58:54 +0200 Subject: [PATCH] actions: properly release resources once the external command exits --- sftpd/sftpd.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sftpd/sftpd.go b/sftpd/sftpd.go index b234f5d3..5b39a814 100644 --- a/sftpd/sftpd.go +++ b/sftpd/sftpd.go @@ -321,8 +321,11 @@ func executeAction(operation string, username string, path string, target string if _, err = os.Stat(actions.Command); err == nil { command := exec.Command(actions.Command, operation, username, path, target) err = command.Start() - logger.Debug(logSender, "executed command \"%v\" with arguments: %v, %v, %v, %v, error: %v", + logger.Debug(logSender, "start command \"%v\" with arguments: %v, %v, %v, %v, error: %v", actions.Command, operation, username, path, target, err) + if err == nil { + go command.Wait() + } } else { logger.Warn(logSender, "Invalid action command \"%v\" : %v", actions.Command, err) }