OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/installer/util/google_update_util.h" | 5 #include "chrome/installer/util/google_update_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // |timeout| to be base::TimeDelta::FromMilliseconds(INFINITE). | 90 // |timeout| to be base::TimeDelta::FromMilliseconds(INFINITE). |
91 // Returns true if this executes successfully. | 91 // Returns true if this executes successfully. |
92 // Returns false if command execution fails to execute, or times out. | 92 // Returns false if command execution fails to execute, or times out. |
93 bool LaunchProcessAndWaitWithTimeout(const string16& cmd_string, | 93 bool LaunchProcessAndWaitWithTimeout(const string16& cmd_string, |
94 base::TimeDelta timeout) { | 94 base::TimeDelta timeout) { |
95 bool success = false; | 95 bool success = false; |
96 base::win::ScopedHandle process; | 96 base::win::ScopedHandle process; |
97 int exit_code = 0; | 97 int exit_code = 0; |
98 LOG(INFO) << "Launching: " << cmd_string; | 98 LOG(INFO) << "Launching: " << cmd_string; |
99 if (!base::LaunchProcess(cmd_string, base::LaunchOptions(), | 99 if (!base::LaunchProcess(cmd_string, base::LaunchOptions(), |
100 process.Receive())) { | 100 &process)) { |
101 PLOG(ERROR) << "Failed to launch (" << cmd_string << ")"; | 101 PLOG(ERROR) << "Failed to launch (" << cmd_string << ")"; |
102 } else if (!base::WaitForExitCodeWithTimeout(process, &exit_code, timeout)) { | 102 } else if (!base::WaitForExitCodeWithTimeout(process, &exit_code, timeout)) { |
103 // The GetExitCodeProcess failed or timed-out. | 103 // The GetExitCodeProcess failed or timed-out. |
104 LOG(ERROR) <<"Command (" << cmd_string << ") is taking more than " | 104 LOG(ERROR) <<"Command (" << cmd_string << ") is taking more than " |
105 << timeout.InMilliseconds() << " milliseconds to complete."; | 105 << timeout.InMilliseconds() << " milliseconds to complete."; |
106 } else if (exit_code != 0) { | 106 } else if (exit_code != 0) { |
107 LOG(ERROR) << "Command (" << cmd_string << ") exited with code " | 107 LOG(ERROR) << "Command (" << cmd_string << ") exited with code " |
108 << exit_code; | 108 << exit_code; |
109 } else { | 109 } else { |
110 success = true; | 110 success = true; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 std::map<std::string, std::string>::const_iterator data_it( | 215 std::map<std::string, std::string>::const_iterator data_it( |
216 untrusted_data.find(key)); | 216 untrusted_data.find(key)); |
217 if (data_it != untrusted_data.end()) | 217 if (data_it != untrusted_data.end()) |
218 return data_it->second; | 218 return data_it->second; |
219 } | 219 } |
220 | 220 |
221 return std::string(); | 221 return std::string(); |
222 } | 222 } |
223 | 223 |
224 } // namespace google_update | 224 } // namespace google_update |
OLD | NEW |