Windows: Reworked error messages in subprocess.

This commit clarifies a few error messages when launching subprocesses
on Windows (via libprocess).  The most substantial change is the
addition of the `command` string to each of the possible error messages.


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/7bd4349d
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/7bd4349d
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/7bd4349d

Branch: refs/heads/master
Commit: 7bd4349d48704782e1fecac81aa7ff9e09774610
Parents: 0eee031
Author: Joseph Wu <[email protected]>
Authored: Mon Mar 6 11:03:32 2017 -0800
Committer: Joseph Wu <[email protected]>
Committed: Thu Mar 9 13:29:01 2017 -0800

----------------------------------------------------------------------
 .../include/process/windows/subprocess.hpp           | 15 ++++++---------
 3rdparty/libprocess/src/subprocess.cpp               |  2 +-
 2 files changed, 7 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/7bd4349d/3rdparty/libprocess/include/process/windows/subprocess.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/windows/subprocess.hpp 
b/3rdparty/libprocess/include/process/windows/subprocess.hpp
index 0e652cc..1d93b08 100644
--- a/3rdparty/libprocess/include/process/windows/subprocess.hpp
+++ b/3rdparty/libprocess/include/process/windows/subprocess.hpp
@@ -207,7 +207,8 @@ inline Try<PROCESS_INFORMATION> createChildProcess(
       &processInfo);           // PROCESS_INFORMATION pointer.
 
   if (!createProcessResult) {
-    return WindowsError("createChildProcess: failed to call 'CreateProcess'");
+    return WindowsError(
+        "Failed to call CreateProcess on command '" + command + "'");
   }
 
   // Run the parent hooks.
@@ -218,10 +219,6 @@ inline Try<PROCESS_INFORMATION> createChildProcess(
     // If the hook callback fails, we shouldn't proceed with the
     // execution and hence the child process should be killed.
     if (parentSetup.isError()) {
-      LOG(WARNING)
-        << "Failed to execute Subprocess::ParentHook in parent for child '"
-        << pid << "': " << parentSetup.error();
-
       // Attempt to kill the process. Since it is still in suspended state, we
       // do not need to kill any descendents. We also can't use `os::kill_job`
       // because this process is not in a Job Object unless one of the parent
@@ -229,15 +226,15 @@ inline Try<PROCESS_INFORMATION> createChildProcess(
       ::TerminateProcess(processInfo.hProcess, 1);
 
       return Error(
-          "Failed to execute Subprocess::ParentHook in parent for child '" +
-          stringify(pid) + "': " + parentSetup.error());
+          "Failed to execute Parent Hook in child '" + stringify(pid) +
+          "' with command '" + command + "': " + parentSetup.error());
     }
   }
 
   // Start child process.
   if (::ResumeThread(processInfo.hThread) == -1) {
-    return WindowsError("process::createChildProcess: Could not spawn child "
-                        "process");
+    return WindowsError(
+        "Failed to resume child process with command '" + command + "'");
   }
 
   return processInfo;

http://git-wip-us.apache.org/repos/asf/mesos/blob/7bd4349d/3rdparty/libprocess/src/subprocess.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/subprocess.cpp 
b/3rdparty/libprocess/src/subprocess.cpp
index bc1b99b..6dfb939 100644
--- a/3rdparty/libprocess/src/subprocess.cpp
+++ b/3rdparty/libprocess/src/subprocess.cpp
@@ -411,7 +411,7 @@ Try<Subprocess> subprocess(
     if (processInformation.isError()) {
       process::internal::close(stdinfds, stdoutfds, stderrfds);
       return Error(
-          "Could not launch child process" + processInformation.error());
+          "Could not launch child process: " + processInformation.error());
     }
 
     if (processInformation.get().dwProcessId == -1) {

Reply via email to