Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: tools/gn/exec_process.cc

Issue 986113002: tools/gn: Convert for loops to use the new range-based loops in C++11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more fixes Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 (const auto& elem : fd_shuffle1)
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698