Commit 7e47f6d4 authored by Peter McNeeley's avatar Peter McNeeley Committed by Commit Bot

Improved error reporting when execvp fails

Currently the execvp fails for a launch process it does not give
much diagnosis. This change reports the errno reason why the execvp
failed. This has been useful in finding simple naming errors.

Change-Id: Ifcc33c87931535019d8509234818c9d995fa4b9d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2383292
Commit-Queue: Peter McNeeley <petermcneeley@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804383}
parent da40d0fd
......@@ -35,6 +35,7 @@
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/posix/eintr_wrapper.h"
#include "base/posix/safe_strerror.h"
#include "base/process/environment_internal.h"
#include "base/process/process.h"
#include "base/process/process_metrics.h"
......@@ -485,6 +486,9 @@ Process LaunchProcess(const std::vector<std::string>& argv,
RAW_LOG(ERROR, "LaunchProcess: failed to execvp:");
RAW_LOG(ERROR, argv_cstr[0]);
char error_buff[256] = {};
base::safe_strerror_r(errno, error_buff, sizeof(error_buff));
RAW_LOG(ERROR, error_buff);
_exit(127);
} else {
// Parent process
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment