Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 1 | //===- llvm/System/Unix/Program.cpp -----------------------------*- C++ -*-===// |
Mikhail Glushenkov | 234f689 | 2009-07-17 20:38:17 +0000 | [diff] [blame] | 2 | // |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Mikhail Glushenkov | 234f689 | 2009-07-17 20:38:17 +0000 | [diff] [blame] | 7 | // |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file implements the Unix specific portion of the Program class. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | //=== WARNING: Implementation here must contain only generic UNIX code that |
| 16 | //=== is guaranteed to work on *all* UNIX variants. |
| 17 | //===----------------------------------------------------------------------===// |
| 18 | |
Reid Spencer | 551ccae | 2004-09-01 22:55:40 +0000 | [diff] [blame] | 19 | #include <llvm/Config/config.h> |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 20 | #include "Unix.h" |
Bill Wendling | 6445537 | 2008-05-29 22:02:08 +0000 | [diff] [blame] | 21 | #include <iostream> |
Reid Spencer | cdf54d0 | 2004-12-27 06:16:52 +0000 | [diff] [blame] | 22 | #if HAVE_SYS_STAT_H |
| 23 | #include <sys/stat.h> |
| 24 | #endif |
Anton Korobeynikov | 9ba8a76 | 2007-02-16 19:11:07 +0000 | [diff] [blame] | 25 | #if HAVE_SYS_RESOURCE_H |
| 26 | #include <sys/resource.h> |
| 27 | #endif |
Reid Spencer | cdf54d0 | 2004-12-27 06:16:52 +0000 | [diff] [blame] | 28 | #if HAVE_SIGNAL_H |
| 29 | #include <signal.h> |
| 30 | #endif |
| 31 | #if HAVE_FCNTL_H |
| 32 | #include <fcntl.h> |
| 33 | #endif |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 34 | |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 35 | namespace llvm { |
| 36 | using namespace sys; |
| 37 | |
Daniel Dunbar | defc853 | 2009-08-03 05:02:46 +0000 | [diff] [blame^] | 38 | Program::Program() : Pid_(0) {} |
| 39 | |
| 40 | Program::~Program() {} |
| 41 | |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 42 | // This function just uses the PATH environment variable to find the program. |
Reid Spencer | 2565943 | 2004-09-13 21:48:44 +0000 | [diff] [blame] | 43 | Path |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 44 | Program::FindProgramByName(const std::string& progName) { |
| 45 | |
| 46 | // Check some degenerate cases |
| 47 | if (progName.length() == 0) // no program |
Reid Spencer | 2565943 | 2004-09-13 21:48:44 +0000 | [diff] [blame] | 48 | return Path(); |
| 49 | Path temp; |
Reid Spencer | dd04df0 | 2005-07-07 23:21:43 +0000 | [diff] [blame] | 50 | if (!temp.set(progName)) // invalid name |
Reid Spencer | 2565943 | 2004-09-13 21:48:44 +0000 | [diff] [blame] | 51 | return Path(); |
Benjamin Kramer | b0facb1 | 2009-07-28 22:08:15 +0000 | [diff] [blame] | 52 | // Use the given path verbatim if it contains any slashes; this matches |
| 53 | // the behavior of sh(1) and friends. |
Dan Gohman | a87861e | 2009-07-28 23:25:18 +0000 | [diff] [blame] | 54 | if (progName.find('/') != std::string::npos) |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 55 | return temp; |
| 56 | |
| 57 | // At this point, the file name is valid and its not executable |
Mikhail Glushenkov | 234f689 | 2009-07-17 20:38:17 +0000 | [diff] [blame] | 58 | |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 59 | // Get the path. If its empty, we can't do anything to find it. |
| 60 | const char *PathStr = getenv("PATH"); |
Mikhail Glushenkov | 234f689 | 2009-07-17 20:38:17 +0000 | [diff] [blame] | 61 | if (PathStr == 0) |
Reid Spencer | 2565943 | 2004-09-13 21:48:44 +0000 | [diff] [blame] | 62 | return Path(); |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 63 | |
| 64 | // Now we have a colon separated list of directories to search; try them. |
Evan Cheng | 34cd4a4 | 2008-05-05 18:30:58 +0000 | [diff] [blame] | 65 | size_t PathLen = strlen(PathStr); |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 66 | while (PathLen) { |
| 67 | // Find the first colon... |
| 68 | const char *Colon = std::find(PathStr, PathStr+PathLen, ':'); |
| 69 | |
| 70 | // Check to see if this first directory contains the executable... |
Reid Spencer | 2565943 | 2004-09-13 21:48:44 +0000 | [diff] [blame] | 71 | Path FilePath; |
Reid Spencer | dd04df0 | 2005-07-07 23:21:43 +0000 | [diff] [blame] | 72 | if (FilePath.set(std::string(PathStr,Colon))) { |
| 73 | FilePath.appendComponent(progName); |
Reid Spencer | c7f0832 | 2005-07-07 18:21:42 +0000 | [diff] [blame] | 74 | if (FilePath.canExecute()) |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 75 | return FilePath; // Found the executable! |
| 76 | } |
| 77 | |
| 78 | // Nope it wasn't in this directory, check the next path in the list! |
| 79 | PathLen -= Colon-PathStr; |
| 80 | PathStr = Colon; |
| 81 | |
| 82 | // Advance past duplicate colons |
| 83 | while (*PathStr == ':') { |
| 84 | PathStr++; |
| 85 | PathLen--; |
| 86 | } |
| 87 | } |
Reid Spencer | 2565943 | 2004-09-13 21:48:44 +0000 | [diff] [blame] | 88 | return Path(); |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 89 | } |
| 90 | |
Matthijs Kooijman | 905261e | 2008-06-12 10:47:18 +0000 | [diff] [blame] | 91 | static bool RedirectIO(const Path *Path, int FD, std::string* ErrMsg) { |
| 92 | if (Path == 0) |
| 93 | // Noop |
| 94 | return false; |
| 95 | std::string File; |
| 96 | if (Path->isEmpty()) |
| 97 | // Redirect empty paths to /dev/null |
| 98 | File = "/dev/null"; |
| 99 | else |
| 100 | File = Path->toString(); |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 101 | |
| 102 | // Open the file |
| 103 | int InFD = open(File.c_str(), FD == 0 ? O_RDONLY : O_WRONLY|O_CREAT, 0666); |
| 104 | if (InFD == -1) { |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 105 | MakeErrMsg(ErrMsg, "Cannot open file '" + File + "' for " |
Daniel Dunbar | a7f2a9e | 2009-04-20 20:50:13 +0000 | [diff] [blame] | 106 | + (FD == 0 ? "input" : "output")); |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 107 | return true; |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 108 | } |
| 109 | |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 110 | // Install it as the requested FD |
| 111 | if (-1 == dup2(InFD, FD)) { |
| 112 | MakeErrMsg(ErrMsg, "Cannot dup2"); |
| 113 | return true; |
| 114 | } |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 115 | close(InFD); // Close the original FD |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 116 | return false; |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 117 | } |
| 118 | |
| 119 | static bool Timeout = false; |
| 120 | static void TimeOutHandler(int Sig) { |
| 121 | Timeout = true; |
| 122 | } |
| 123 | |
Anton Korobeynikov | 9ba8a76 | 2007-02-16 19:11:07 +0000 | [diff] [blame] | 124 | static void SetMemoryLimits (unsigned size) |
| 125 | { |
| 126 | #if HAVE_SYS_RESOURCE_H |
| 127 | struct rlimit r; |
| 128 | __typeof__ (r.rlim_cur) limit = (__typeof__ (r.rlim_cur)) (size) * 1048576; |
| 129 | |
| 130 | // Heap size |
| 131 | getrlimit (RLIMIT_DATA, &r); |
| 132 | r.rlim_cur = limit; |
| 133 | setrlimit (RLIMIT_DATA, &r); |
Gabor Greif | aa6b7fd | 2007-07-06 10:31:27 +0000 | [diff] [blame] | 134 | #ifdef RLIMIT_RSS |
Anton Korobeynikov | 9ba8a76 | 2007-02-16 19:11:07 +0000 | [diff] [blame] | 135 | // Resident set size. |
| 136 | getrlimit (RLIMIT_RSS, &r); |
| 137 | r.rlim_cur = limit; |
| 138 | setrlimit (RLIMIT_RSS, &r); |
Reid Spencer | 2e40d03 | 2007-04-23 07:22:51 +0000 | [diff] [blame] | 139 | #endif |
Devang Patel | 69bdf68 | 2007-06-04 15:28:57 +0000 | [diff] [blame] | 140 | #ifdef RLIMIT_AS // e.g. NetBSD doesn't have it. |
Anton Korobeynikov | 9ba8a76 | 2007-02-16 19:11:07 +0000 | [diff] [blame] | 141 | // Virtual memory. |
| 142 | getrlimit (RLIMIT_AS, &r); |
| 143 | r.rlim_cur = limit; |
| 144 | setrlimit (RLIMIT_AS, &r); |
| 145 | #endif |
Devang Patel | 69bdf68 | 2007-06-04 15:28:57 +0000 | [diff] [blame] | 146 | #endif |
Anton Korobeynikov | 9ba8a76 | 2007-02-16 19:11:07 +0000 | [diff] [blame] | 147 | } |
| 148 | |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 149 | bool |
| 150 | Program::Execute(const Path& path, |
| 151 | const char** args, |
| 152 | const char** envp, |
| 153 | const Path** redirects, |
| 154 | unsigned memoryLimit, |
| 155 | std::string* ErrMsg) |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 156 | { |
| 157 | if (!path.canExecute()) { |
| 158 | if (ErrMsg) |
| 159 | *ErrMsg = path.toString() + " is not executable"; |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 160 | return false; |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 161 | } |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 162 | |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 163 | // Create a child process. |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 164 | int child = fork(); |
| 165 | switch (child) { |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 166 | // An error occured: Return to the caller. |
| 167 | case -1: |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 168 | MakeErrMsg(ErrMsg, "Couldn't fork"); |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 169 | return false; |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 170 | |
| 171 | // Child process: Execute the program. |
Reid Spencer | e2e2411 | 2004-12-14 04:18:51 +0000 | [diff] [blame] | 172 | case 0: { |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 173 | // Redirect file descriptors... |
| 174 | if (redirects) { |
Matthijs Kooijman | cf45ca0 | 2008-06-12 12:53:35 +0000 | [diff] [blame] | 175 | // Redirect stdin |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 176 | if (RedirectIO(redirects[0], 0, ErrMsg)) { return false; } |
Matthijs Kooijman | cf45ca0 | 2008-06-12 12:53:35 +0000 | [diff] [blame] | 177 | // Redirect stdout |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 178 | if (RedirectIO(redirects[1], 1, ErrMsg)) { return false; } |
Mikhail Glushenkov | 234f689 | 2009-07-17 20:38:17 +0000 | [diff] [blame] | 179 | if (redirects[1] && redirects[2] && |
Matthijs Kooijman | cf45ca0 | 2008-06-12 12:53:35 +0000 | [diff] [blame] | 180 | *(redirects[1]) == *(redirects[2])) { |
| 181 | // If stdout and stderr should go to the same place, redirect stderr |
| 182 | // to the FD already open for stdout. |
| 183 | if (-1 == dup2(1,2)) { |
| 184 | MakeErrMsg(ErrMsg, "Can't redirect stderr to stdout"); |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 185 | return false; |
Matthijs Kooijman | cf45ca0 | 2008-06-12 12:53:35 +0000 | [diff] [blame] | 186 | } |
| 187 | } else { |
| 188 | // Just redirect stderr |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 189 | if (RedirectIO(redirects[2], 2, ErrMsg)) { return false; } |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 190 | } |
| 191 | } |
| 192 | |
Anton Korobeynikov | 9ba8a76 | 2007-02-16 19:11:07 +0000 | [diff] [blame] | 193 | // Set memory limits |
| 194 | if (memoryLimit!=0) { |
| 195 | SetMemoryLimits(memoryLimit); |
| 196 | } |
Mikhail Glushenkov | 234f689 | 2009-07-17 20:38:17 +0000 | [diff] [blame] | 197 | |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 198 | // Execute! |
Evan Cheng | 2fafaf1 | 2006-06-09 20:43:11 +0000 | [diff] [blame] | 199 | if (envp != 0) |
Dan Gohman | cb648f9 | 2007-09-14 20:08:19 +0000 | [diff] [blame] | 200 | execve (path.c_str(), (char**)args, (char**)envp); |
Evan Cheng | 2fafaf1 | 2006-06-09 20:43:11 +0000 | [diff] [blame] | 201 | else |
Dan Gohman | cb648f9 | 2007-09-14 20:08:19 +0000 | [diff] [blame] | 202 | execv (path.c_str(), (char**)args); |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 203 | // If the execve() failed, we should exit and let the parent pick up |
| 204 | // our non-zero exit status. |
| 205 | exit (errno); |
Reid Spencer | e2e2411 | 2004-12-14 04:18:51 +0000 | [diff] [blame] | 206 | } |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 207 | |
| 208 | // Parent process: Break out of the switch to do our processing. |
| 209 | default: |
| 210 | break; |
| 211 | } |
| 212 | |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 213 | // Make sure stderr and stdout have been flushed |
Bill Wendling | 6445537 | 2008-05-29 22:02:08 +0000 | [diff] [blame] | 214 | std::cerr << std::flush; |
| 215 | std::cout << std::flush; |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 216 | fsync(1); |
| 217 | fsync(2); |
| 218 | |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 219 | Pid_ = child; |
| 220 | |
| 221 | return true; |
| 222 | } |
| 223 | |
| 224 | int |
| 225 | Program::Wait(unsigned secondsToWait, |
| 226 | std::string* ErrMsg) |
| 227 | { |
| 228 | #ifdef HAVE_SYS_WAIT_H |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 229 | struct sigaction Act, Old; |
| 230 | |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 231 | if (Pid_ == 0) { |
| 232 | MakeErrMsg(ErrMsg, "Process not started!"); |
| 233 | return -1; |
| 234 | } |
| 235 | |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 236 | // Install a timeout handler. |
| 237 | if (secondsToWait) { |
| 238 | Timeout = false; |
| 239 | Act.sa_sigaction = 0; |
| 240 | Act.sa_handler = TimeOutHandler; |
| 241 | sigemptyset(&Act.sa_mask); |
| 242 | Act.sa_flags = 0; |
| 243 | sigaction(SIGALRM, &Act, &Old); |
| 244 | alarm(secondsToWait); |
| 245 | } |
| 246 | |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 247 | // Parent process: Wait for the child process to terminate. |
| 248 | int status; |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 249 | int child = this->Pid_; |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 250 | while (wait(&status) != child) |
| 251 | if (secondsToWait && errno == EINTR) { |
| 252 | // Kill the child. |
| 253 | kill(child, SIGKILL); |
Mikhail Glushenkov | 234f689 | 2009-07-17 20:38:17 +0000 | [diff] [blame] | 254 | |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 255 | // Turn off the alarm and restore the signal handler |
| 256 | alarm(0); |
| 257 | sigaction(SIGALRM, &Old, 0); |
| 258 | |
| 259 | // Wait for child to die |
| 260 | if (wait(&status) != child) |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 261 | MakeErrMsg(ErrMsg, "Child timed out but wouldn't die"); |
Devang Patel | a1e4bba | 2008-02-04 20:57:54 +0000 | [diff] [blame] | 262 | else |
| 263 | MakeErrMsg(ErrMsg, "Child timed out", 0); |
| 264 | |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 265 | return -1; // Timeout detected |
Devang Patel | a1e4bba | 2008-02-04 20:57:54 +0000 | [diff] [blame] | 266 | } else if (errno != EINTR) { |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 267 | MakeErrMsg(ErrMsg, "Error waiting for child process"); |
| 268 | return -1; |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 269 | } |
| 270 | |
| 271 | // We exited normally without timeout, so turn off the timer. |
| 272 | if (secondsToWait) { |
| 273 | alarm(0); |
| 274 | sigaction(SIGALRM, &Old, 0); |
| 275 | } |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 276 | |
Reid Spencer | d555f41 | 2005-12-22 20:00:16 +0000 | [diff] [blame] | 277 | // Return the proper exit status. 0=success, >0 is programs' exit status, |
| 278 | // <0 means a signal was returned, -9999999 means the program dumped core. |
| 279 | int result = 0; |
Chris Lattner | 0228c0f | 2006-07-12 22:37:18 +0000 | [diff] [blame] | 280 | if (WIFEXITED(status)) |
Reid Spencer | d555f41 | 2005-12-22 20:00:16 +0000 | [diff] [blame] | 281 | result = WEXITSTATUS(status); |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 282 | else if (WIFSIGNALED(status)) |
Reid Spencer | d555f41 | 2005-12-22 20:00:16 +0000 | [diff] [blame] | 283 | result = 0 - WTERMSIG(status); |
| 284 | #ifdef WCOREDUMP |
Chris Lattner | 0228c0f | 2006-07-12 22:37:18 +0000 | [diff] [blame] | 285 | else if (WCOREDUMP(status)) |
Reid Spencer | d555f41 | 2005-12-22 20:00:16 +0000 | [diff] [blame] | 286 | result |= 0x01000000; |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 287 | #endif |
Reid Spencer | d555f41 | 2005-12-22 20:00:16 +0000 | [diff] [blame] | 288 | return result; |
| 289 | #else |
| 290 | return -99; |
| 291 | #endif |
Mikhail Glushenkov | 234f689 | 2009-07-17 20:38:17 +0000 | [diff] [blame] | 292 | |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 293 | } |
| 294 | |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 295 | bool Program::ChangeStdinToBinary(){ |
Reid Spencer | 32f5553 | 2006-06-07 23:18:34 +0000 | [diff] [blame] | 296 | // Do nothing, as Unix doesn't differentiate between text and binary. |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 297 | return false; |
Reid Spencer | 32f5553 | 2006-06-07 23:18:34 +0000 | [diff] [blame] | 298 | } |
| 299 | |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 300 | bool Program::ChangeStdoutToBinary(){ |
Reid Spencer | 32f5553 | 2006-06-07 23:18:34 +0000 | [diff] [blame] | 301 | // Do nothing, as Unix doesn't differentiate between text and binary. |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 302 | return false; |
Reid Spencer | 32f5553 | 2006-06-07 23:18:34 +0000 | [diff] [blame] | 303 | } |
| 304 | |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 305 | } |