OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/setup/daemon_controller_delegate_linux.h" | 5 #include "remoting/host/setup/daemon_controller_delegate_linux.h" |
6 | 6 |
7 #include <unistd.h> | 7 #include <unistd.h> |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/environment.h" | 14 #include "base/environment.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/files/file_util.h" | 16 #include "base/files/file_util.h" |
17 #include "base/json/json_writer.h" | 17 #include "base/json/json_writer.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/md5.h" | 19 #include "base/md5.h" |
20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
21 #include "base/process/kill.h" | |
22 #include "base/process/launch.h" | 21 #include "base/process/launch.h" |
23 #include "base/process/process_handle.h" | 22 #include "base/process/process.h" |
24 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
25 #include "base/strings/string_split.h" | 24 #include "base/strings/string_split.h" |
26 #include "base/strings/string_util.h" | 25 #include "base/strings/string_util.h" |
27 #include "base/thread_task_runner_handle.h" | 26 #include "base/thread_task_runner_handle.h" |
28 #include "base/values.h" | 27 #include "base/values.h" |
29 #include "build/build_config.h" | 28 #include "build/build_config.h" |
30 #include "net/base/net_util.h" | 29 #include "net/base/net_util.h" |
31 #include "remoting/host/host_config.h" | 30 #include "remoting/host/host_config.h" |
32 #include "remoting/host/usage_stats_consent.h" | 31 #include "remoting/host/usage_stats_consent.h" |
33 | 32 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 #endif | 105 #endif |
107 | 106 |
108 base::Process process = base::LaunchProcess(command_line, options); | 107 base::Process process = base::LaunchProcess(command_line, options); |
109 if (!process.IsValid()) { | 108 if (!process.IsValid()) { |
110 LOG(ERROR) << "Failed to run command: " | 109 LOG(ERROR) << "Failed to run command: " |
111 << command_line.GetCommandLineString(); | 110 << command_line.GetCommandLineString(); |
112 return false; | 111 return false; |
113 } | 112 } |
114 | 113 |
115 if (!process.WaitForExitWithTimeout(timeout, exit_code)) { | 114 if (!process.WaitForExitWithTimeout(timeout, exit_code)) { |
116 base::KillProcess(process.Handle(), 0, false); | 115 process.Terminate(0, false); |
117 LOG(ERROR) << "Timeout exceeded for command: " | 116 LOG(ERROR) << "Timeout exceeded for command: " |
118 << command_line.GetCommandLineString(); | 117 << command_line.GetCommandLineString(); |
119 return false; | 118 return false; |
120 } | 119 } |
121 | 120 |
122 return true; | 121 return true; |
123 } | 122 } |
124 | 123 |
125 bool RunHostScript(const std::vector<std::string>& args, int* exit_code) { | 124 bool RunHostScript(const std::vector<std::string>& args, int* exit_code) { |
126 return RunHostScriptWithTimeout( | 125 return RunHostScriptWithTimeout( |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 return consent; | 276 return consent; |
278 } | 277 } |
279 | 278 |
280 scoped_refptr<DaemonController> DaemonController::Create() { | 279 scoped_refptr<DaemonController> DaemonController::Create() { |
281 scoped_ptr<DaemonController::Delegate> delegate( | 280 scoped_ptr<DaemonController::Delegate> delegate( |
282 new DaemonControllerDelegateLinux()); | 281 new DaemonControllerDelegateLinux()); |
283 return new DaemonController(delegate.Pass()); | 282 return new DaemonController(delegate.Pass()); |
284 } | 283 } |
285 | 284 |
286 } // namespace remoting | 285 } // namespace remoting |
OLD | NEW |