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

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

Issue 100573002: Move directory creation functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « third_party/zlib/google/zip_reader.cc ('k') | tools/gn/function_write_file.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_util.h" 6 #include "base/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/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 349
350 base::FilePath startup_dir = 350 base::FilePath startup_dir =
351 build_settings->GetFullPath(build_settings->build_dir()); 351 build_settings->GetFullPath(build_settings->build_dir());
352 // The first time a build is run, no targets will have been written so the 352 // The first time a build is run, no targets will have been written so the
353 // build output directory won't exist. We need to make sure it does before 353 // build output directory won't exist. We need to make sure it does before
354 // running any scripts with this as its startup directory, although it will 354 // running any scripts with this as its startup directory, although it will
355 // be relatively rare that the directory won't exist by the time we get here. 355 // be relatively rare that the directory won't exist by the time we get here.
356 // 356 //
357 // If this shows up on benchmarks, we can cache whether we've done this 357 // If this shows up on benchmarks, we can cache whether we've done this
358 // or not and skip creating the directory. 358 // or not and skip creating the directory.
359 file_util::CreateDirectory(startup_dir); 359 base::CreateDirectory(startup_dir);
360 360
361 // Execute the process. 361 // Execute the process.
362 // TODO(brettw) set the environment block. 362 // TODO(brettw) set the environment block.
363 std::string output; 363 std::string output;
364 std::string stderr_output; // TODO(brettw) not hooked up, see above. 364 std::string stderr_output; // TODO(brettw) not hooked up, see above.
365 int exit_code = 0; 365 int exit_code = 0;
366 if (!CommandLine::ForCurrentProcess()->HasSwitch(kNoExecSwitch)) { 366 if (!CommandLine::ForCurrentProcess()->HasSwitch(kNoExecSwitch)) {
367 if (!ExecProcess(cmdline, startup_dir, 367 if (!ExecProcess(cmdline, startup_dir,
368 &output, &stderr_output, &exit_code)) { 368 &output, &stderr_output, &exit_code)) {
369 *err = Err(function->function(), "Could not execute python.", 369 *err = Err(function->function(), "Could not execute python.",
(...skipping 19 matching lines...) Expand all
389 msg += "."; 389 msg += ".";
390 *err = Err(function->function(), "Script returned non-zero exit code.", 390 *err = Err(function->function(), "Script returned non-zero exit code.",
391 msg); 391 msg);
392 return Value(); 392 return Value();
393 } 393 }
394 394
395 return ConvertInputToValue(output, function, args[2], err); 395 return ConvertInputToValue(output, function, args[2], err);
396 } 396 }
397 397
398 } // namespace functions 398 } // namespace functions
OLDNEW
« no previous file with comments | « third_party/zlib/google/zip_reader.cc ('k') | tools/gn/function_write_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698