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