From 40b88422d294ab4c3b53c889f54c941ab67216b0 Mon Sep 17 00:00:00 2001 From: Gerd von Egidy Date: Thu, 13 Mar 2014 23:03:59 +0100 Subject: [PATCH] Output child pid to debug log when forking. Fixes #5756 Signed-off-by: Gunnar Beutner --- lib/base/process-unix.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/base/process-unix.cpp b/lib/base/process-unix.cpp index 13052229f..7287963c5 100644 --- a/lib/base/process-unix.cpp +++ b/lib/base/process-unix.cpp @@ -184,8 +184,6 @@ void Process::Run(const boost::function& callback) #endif /* HAVE_PIPE2 */ // build argv - Log(LogDebug, "base", "Running command '" + boost::algorithm::join(m_Arguments, " ") + "'."); - char **argv = new char *[m_Arguments.size() + 1]; for (unsigned int i = 0; i < m_Arguments.size(); i++) @@ -193,8 +191,6 @@ void Process::Run(const boost::function& callback) argv[m_Arguments.size()] = NULL; - m_Arguments.clear(); - // build envp int envc = 0; @@ -262,6 +258,11 @@ void Process::Run(const boost::function& callback) // parent process + Log(LogDebug, "base", "Running command '" + boost::algorithm::join(m_Arguments, " ") + + "': PID " + Convert::ToString(m_Pid)); + + m_Arguments.clear(); + // free arguments for (int i = 0; argv[i] != NULL; i++) free(argv[i]);