OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |