| 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 fd_shuffle1.push_back( | 181 fd_shuffle1.push_back( |
| 182 base::InjectionArc(pipe_fd[1], STDOUT_FILENO, true)); | 182 base::InjectionArc(pipe_fd[1], STDOUT_FILENO, true)); |
| 183 fd_shuffle1.push_back( | 183 fd_shuffle1.push_back( |
| 184 base::InjectionArc(dev_null, STDERR_FILENO, true)); | 184 base::InjectionArc(dev_null, STDERR_FILENO, true)); |
| 185 fd_shuffle1.push_back( | 185 fd_shuffle1.push_back( |
| 186 base::InjectionArc(dev_null, STDIN_FILENO, true)); | 186 base::InjectionArc(dev_null, STDIN_FILENO, true)); |
| 187 // Adding another element here? Remeber to increase the argument to | 187 // Adding another element here? Remeber to increase the argument to |
| 188 // reserve(), above. | 188 // reserve(), above. |
| 189 | 189 |
| 190 std::copy(fd_shuffle1.begin(), fd_shuffle1.end(), | 190 for (size_t i = 0; i < fd_shuffle1.size(); ++i) |
| 191 std::back_inserter(fd_shuffle2)); | 191 fd_shuffle2.push_back(fd_shuffle1[i]); |
| 192 | 192 |
| 193 if (!ShuffleFileDescriptors(&fd_shuffle1)) | 193 if (!ShuffleFileDescriptors(&fd_shuffle1)) |
| 194 _exit(127); | 194 _exit(127); |
| 195 | 195 |
| 196 base::SetCurrentDirectory(startup_dir); | 196 base::SetCurrentDirectory(startup_dir); |
| 197 | 197 |
| 198 // TODO(brettw) the base version GetAppOutput does a | 198 // TODO(brettw) the base version GetAppOutput does a |
| 199 // CloseSuperfluousFds call here. Do we need this? | 199 // CloseSuperfluousFds call here. Do we need this? |
| 200 | 200 |
| 201 for (size_t i = 0; i < argv.size(); i++) | 201 for (size_t i = 0; i < argv.size(); i++) |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 msg); | 408 msg); |
| 409 return Value(); | 409 return Value(); |
| 410 } | 410 } |
| 411 | 411 |
| 412 // Default to None value for the input conversion if unspecified. | 412 // Default to None value for the input conversion if unspecified. |
| 413 return ConvertInputToValue(scope->settings(), output, function, | 413 return ConvertInputToValue(scope->settings(), output, function, |
| 414 args.size() >= 3 ? args[2] : Value(), err); | 414 args.size() >= 3 ? args[2] : Value(), err); |
| 415 } | 415 } |
| 416 | 416 |
| 417 } // namespace functions | 417 } // namespace functions |
| OLD | NEW |