mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 14:50:55 +03:00
actions: properly release resources once the external command exits
This commit is contained in:
@@ -321,8 +321,11 @@ func executeAction(operation string, username string, path string, target string
|
|||||||
if _, err = os.Stat(actions.Command); err == nil {
|
if _, err = os.Stat(actions.Command); err == nil {
|
||||||
command := exec.Command(actions.Command, operation, username, path, target)
|
command := exec.Command(actions.Command, operation, username, path, target)
|
||||||
err = command.Start()
|
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)
|
actions.Command, operation, username, path, target, err)
|
||||||
|
if err == nil {
|
||||||
|
go command.Wait()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.Warn(logSender, "Invalid action command \"%v\" : %v", actions.Command, err)
|
logger.Warn(logSender, "Invalid action command \"%v\" : %v", actions.Command, err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user