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 "chromeos/process_proxy/process_proxy.h" | 5 #include "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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 bool ProcessProxy::LaunchProcess(const std::string& command, int slave_fd, | 218 bool ProcessProxy::LaunchProcess(const std::string& command, int slave_fd, |
219 pid_t* pid) { | 219 pid_t* pid) { |
220 // Redirect crosh process' output and input so we can read it. | 220 // Redirect crosh process' output and input so we can read it. |
221 base::FileHandleMappingVector fds_mapping; | 221 base::FileHandleMappingVector fds_mapping; |
222 fds_mapping.push_back(std::make_pair(slave_fd, STDIN_FILENO)); | 222 fds_mapping.push_back(std::make_pair(slave_fd, STDIN_FILENO)); |
223 fds_mapping.push_back(std::make_pair(slave_fd, STDOUT_FILENO)); | 223 fds_mapping.push_back(std::make_pair(slave_fd, STDOUT_FILENO)); |
224 fds_mapping.push_back(std::make_pair(slave_fd, STDERR_FILENO)); | 224 fds_mapping.push_back(std::make_pair(slave_fd, STDERR_FILENO)); |
225 base::LaunchOptions options; | 225 base::LaunchOptions options; |
226 options.fds_to_remap = &fds_mapping; | 226 options.fds_to_remap = &fds_mapping; |
227 options.ctrl_terminal_fd = slave_fd; | 227 options.ctrl_terminal_fd = slave_fd; |
228 | 228 options.environ["TERM"] = "xterm"; |
229 base::EnvironmentVector environ; | |
230 environ.push_back(std::make_pair("TERM", "xterm")); | |
231 options.environ = &environ; | |
232 | 229 |
233 // Launch the process. | 230 // Launch the process. |
234 return base::LaunchProcess(CommandLine(base::FilePath(command)), options, | 231 return base::LaunchProcess(CommandLine(base::FilePath(command)), options, |
235 pid); | 232 pid); |
236 } | 233 } |
237 | 234 |
238 void ProcessProxy::CloseAllFdPairs() { | 235 void ProcessProxy::CloseAllFdPairs() { |
239 CloseFdPair(pt_pair_); | 236 CloseFdPair(pt_pair_); |
240 CloseFdPair(shutdown_pipe_); | 237 CloseFdPair(shutdown_pipe_); |
241 } | 238 } |
(...skipping 15 matching lines...) Expand all Loading... |
257 ClearFdPair(pt_pair_); | 254 ClearFdPair(pt_pair_); |
258 ClearFdPair(shutdown_pipe_); | 255 ClearFdPair(shutdown_pipe_); |
259 } | 256 } |
260 | 257 |
261 void ProcessProxy::ClearFdPair(int* pipe) { | 258 void ProcessProxy::ClearFdPair(int* pipe) { |
262 pipe[PIPE_END_READ] = kInvalidFd; | 259 pipe[PIPE_END_READ] = kInvalidFd; |
263 pipe[PIPE_END_WRITE] = kInvalidFd; | 260 pipe[PIPE_END_WRITE] = kInvalidFd; |
264 } | 261 } |
265 | 262 |
266 } // namespace chromeos | 263 } // namespace chromeos |
OLD | NEW |