| Index: remoting/host/setup/daemon_controller_delegate_linux.cc
|
| diff --git a/remoting/host/setup/daemon_controller_delegate_linux.cc b/remoting/host/setup/daemon_controller_delegate_linux.cc
|
| index d323e1c66e8a23030a26ccf7ebfe2aa8f6b6e7d6..7e7804612ff43616d6141b8aadb24b4decffc464 100644
|
| --- a/remoting/host/setup/daemon_controller_delegate_linux.cc
|
| +++ b/remoting/host/setup/daemon_controller_delegate_linux.cc
|
| @@ -114,8 +114,7 @@ bool RunHostScriptWithTimeout(
|
| return true;
|
| }
|
|
|
| -bool RunHostScript(const std::vector<std::string>& args,
|
| - int* exit_code) {
|
| +bool RunHostScript(const std::vector<std::string>& args, int* exit_code) {
|
| return RunHostScriptWithTimeout(
|
| args, base::TimeDelta::FromMilliseconds(kDaemonTimeoutMs), exit_code);
|
| }
|
| @@ -129,20 +128,43 @@ DaemonControllerDelegateLinux::~DaemonControllerDelegateLinux() {
|
| }
|
|
|
| DaemonController::State DaemonControllerDelegateLinux::GetState() {
|
| - std::vector<std::string> args;
|
| - args.push_back("--check-running");
|
| + base::FilePath script_path;
|
| + if (!GetScriptPath(&script_path)) {
|
| + return DaemonController::STATE_NOT_IMPLEMENTED;
|
| + }
|
| + CommandLine command_line(script_path);
|
| + command_line.AppendArg("--get-status");
|
| +
|
| + std::string status;
|
| int exit_code = 0;
|
| - if (!RunHostScript(args, &exit_code)) {
|
| + bool result =
|
| + base::GetAppOutputWithExitCode(command_line, &status, &exit_code);
|
| + if (!result) {
|
| // TODO(jamiewalch): When we have a good story for installing, return
|
| // NOT_INSTALLED rather than NOT_IMPLEMENTED (the former suppresses
|
| // the relevant UI in the web-app).
|
| return DaemonController::STATE_NOT_IMPLEMENTED;
|
| }
|
|
|
| - if (exit_code == 0) {
|
| + if (exit_code != 0) {
|
| + LOG(ERROR) << "Failed to run \"" << command_line.GetCommandLineString()
|
| + << "\". Exit code: " << exit_code;
|
| + return DaemonController::STATE_UNKNOWN;
|
| + }
|
| +
|
| + TrimWhitespaceASCII(status, TRIM_ALL, &status);
|
| +
|
| + if (status == "STARTED") {
|
| return DaemonController::STATE_STARTED;
|
| - } else {
|
| + } else if (status == "STOPPED") {
|
| return DaemonController::STATE_STOPPED;
|
| + } else if (status == "NOT_IMPLEMENTED") {
|
| + return DaemonController::STATE_NOT_IMPLEMENTED;
|
| + } else {
|
| + LOG(ERROR) << "Unknown status string returned from \""
|
| + << command_line.GetCommandLineString()
|
| + << "\": " << status;
|
| + return DaemonController::STATE_UNKNOWN;
|
| }
|
| }
|
|
|
|
|