| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS 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 "update_engine/subprocess.h" | 5 #include "update_engine/subprocess.h" |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <unistd.h> | 9 #include <unistd.h> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 return false; | 155 return false; |
| 156 } | 156 } |
| 157 ScopedFreeArgPointer argp_free(argp); | 157 ScopedFreeArgPointer argp_free(argp); |
| 158 | 158 |
| 159 char* child_stdout; | 159 char* child_stdout; |
| 160 | 160 |
| 161 bool success = g_spawn_sync( | 161 bool success = g_spawn_sync( |
| 162 NULL, // working directory | 162 NULL, // working directory |
| 163 argv.get(), | 163 argv.get(), |
| 164 argp, | 164 argp, |
| 165 static_cast<GSpawnFlags>(G_SPAWN_STDERR_TO_DEV_NULL | flags), // flags | 165 static_cast<GSpawnFlags>(G_SPAWN_STDERR_TO_DEV_NULL | |
| 166 G_SPAWN_SEARCH_PATH | flags), // flags |
| 166 GRedirectStderrToStdout, // child setup function | 167 GRedirectStderrToStdout, // child setup function |
| 167 NULL, // data for child setup function | 168 NULL, // data for child setup function |
| 168 &child_stdout, | 169 &child_stdout, |
| 169 NULL, | 170 NULL, |
| 170 return_code, | 171 return_code, |
| 171 &err); | 172 &err); |
| 172 FreeArgv(argv.get()); | 173 FreeArgv(argv.get()); |
| 173 if (err) | 174 if (err) |
| 174 LOG(INFO) << "err is: " << err->code << ", " << err->message; | 175 LOG(INFO) << "err is: " << err->code << ", " << err->message; |
| 175 if (child_stdout && strlen(child_stdout)) | 176 if (child_stdout && strlen(child_stdout)) |
| 176 LOG(INFO) << "Subprocess output:\n" << child_stdout; | 177 LOG(INFO) << "Subprocess output:\n" << child_stdout; |
| 177 return success; | 178 return success; |
| 178 } | 179 } |
| 179 | 180 |
| 180 Subprocess* Subprocess::subprocess_singleton_ = NULL; | 181 Subprocess* Subprocess::subprocess_singleton_ = NULL; |
| 181 | 182 |
| 182 } // namespace chromeos_update_engine | 183 } // namespace chromeos_update_engine |
| OLD | NEW |