Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/process/kill.h" | 8 #include "base/process/kill.h" |
| 9 #include "base/process/launch.h" | 9 #include "base/process/launch.h" |
| 10 #include "base/process/process.h" | 10 #include "base/process/process.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 | 187 |
| 188 fd_shuffle1.push_back( | 188 fd_shuffle1.push_back( |
| 189 base::InjectionArc(out_write.get(), STDOUT_FILENO, true)); | 189 base::InjectionArc(out_write.get(), STDOUT_FILENO, true)); |
| 190 fd_shuffle1.push_back( | 190 fd_shuffle1.push_back( |
| 191 base::InjectionArc(err_write.get(), STDERR_FILENO, true)); | 191 base::InjectionArc(err_write.get(), STDERR_FILENO, true)); |
| 192 fd_shuffle1.push_back( | 192 fd_shuffle1.push_back( |
| 193 base::InjectionArc(dev_null, STDIN_FILENO, true)); | 193 base::InjectionArc(dev_null, STDIN_FILENO, true)); |
| 194 // Adding another element here? Remeber to increase the argument to | 194 // Adding another element here? Remeber to increase the argument to |
| 195 // reserve(), above. | 195 // reserve(), above. |
| 196 | 196 |
| 197 for (size_t i = 0; i < fd_shuffle1.size(); ++i) | 197 for (auto& elem : fd_shuffle1) |
|
scottmg
2015/03/13 19:58:30
const?
tfarina
2015/03/13 23:27:49
Done.
| |
| 198 fd_shuffle2.push_back(fd_shuffle1[i]); | 198 fd_shuffle2.push_back(elem); |
| 199 | 199 |
| 200 if (!ShuffleFileDescriptors(&fd_shuffle1)) | 200 if (!ShuffleFileDescriptors(&fd_shuffle1)) |
| 201 _exit(127); | 201 _exit(127); |
| 202 | 202 |
| 203 base::SetCurrentDirectory(startup_dir); | 203 base::SetCurrentDirectory(startup_dir); |
| 204 | 204 |
| 205 // TODO(brettw) the base version GetAppOutput does a | 205 // TODO(brettw) the base version GetAppOutput does a |
| 206 // CloseSuperfluousFds call here. Do we need this? | 206 // CloseSuperfluousFds call here. Do we need this? |
| 207 | 207 |
| 208 for (size_t i = 0; i < argv.size(); i++) | 208 for (size_t i = 0; i < argv.size(); i++) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 return process.WaitForExit(exit_code); | 240 return process.WaitForExit(exit_code); |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 | 243 |
| 244 return false; | 244 return false; |
| 245 } | 245 } |
| 246 #endif | 246 #endif |
| 247 | 247 |
| 248 } // namespace internal | 248 } // namespace internal |
| 249 | 249 |
| OLD | NEW |