| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/process_proxy/process_proxy.h" | 5 #include "chrome/browser/chromeos/process_proxy/process_proxy.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <sys/ioctl.h> | 9 #include <sys/ioctl.h> |
| 10 | 10 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 pid_t* pid) { | 209 pid_t* pid) { |
| 210 // Redirect crosh process' output and input so we can read it. | 210 // Redirect crosh process' output and input so we can read it. |
| 211 base::FileHandleMappingVector fds_mapping; | 211 base::FileHandleMappingVector fds_mapping; |
| 212 fds_mapping.push_back(std::make_pair(slave_fd, STDIN_FILENO)); | 212 fds_mapping.push_back(std::make_pair(slave_fd, STDIN_FILENO)); |
| 213 fds_mapping.push_back(std::make_pair(slave_fd, STDOUT_FILENO)); | 213 fds_mapping.push_back(std::make_pair(slave_fd, STDOUT_FILENO)); |
| 214 fds_mapping.push_back(std::make_pair(slave_fd, STDERR_FILENO)); | 214 fds_mapping.push_back(std::make_pair(slave_fd, STDERR_FILENO)); |
| 215 base::LaunchOptions options; | 215 base::LaunchOptions options; |
| 216 options.fds_to_remap = &fds_mapping; | 216 options.fds_to_remap = &fds_mapping; |
| 217 options.ctrl_terminal_fd = slave_fd; | 217 options.ctrl_terminal_fd = slave_fd; |
| 218 | 218 |
| 219 base::EnvironmentVector environ; |
| 220 environ.push_back(std::make_pair("TERM", "xterm")); |
| 221 options.environ = &environ; |
| 222 |
| 219 // Launch the process. | 223 // Launch the process. |
| 220 return base::LaunchProcess(CommandLine(base::FilePath(command)), options, | 224 return base::LaunchProcess(CommandLine(base::FilePath(command)), options, |
| 221 pid); | 225 pid); |
| 222 } | 226 } |
| 223 | 227 |
| 224 void ProcessProxy::CloseAllFdPairs() { | 228 void ProcessProxy::CloseAllFdPairs() { |
| 225 CloseFdPair(pt_pair_); | 229 CloseFdPair(pt_pair_); |
| 226 CloseFdPair(shutdown_pipe_); | 230 CloseFdPair(shutdown_pipe_); |
| 227 } | 231 } |
| 228 | 232 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 241 | 245 |
| 242 void ProcessProxy::ClearAllFdPairs() { | 246 void ProcessProxy::ClearAllFdPairs() { |
| 243 ClearFdPair(pt_pair_); | 247 ClearFdPair(pt_pair_); |
| 244 ClearFdPair(shutdown_pipe_); | 248 ClearFdPair(shutdown_pipe_); |
| 245 } | 249 } |
| 246 | 250 |
| 247 void ProcessProxy::ClearFdPair(int* pipe) { | 251 void ProcessProxy::ClearFdPair(int* pipe) { |
| 248 pipe[PIPE_END_READ] = kInvalidFd; | 252 pipe[PIPE_END_READ] = kInvalidFd; |
| 249 pipe[PIPE_END_WRITE] = kInvalidFd; | 253 pipe[PIPE_END_WRITE] = kInvalidFd; |
| 250 } | 254 } |
| OLD | NEW |