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" |
Reid Spencer | cdf54d0 | 2004-12-27 06:16:52 +0000 | [diff] [blame] | 21 | #if HAVE_SYS_STAT_H |
| 22 | #include <sys/stat.h> |
| 23 | #endif |
Anton Korobeynikov | 9ba8a76 | 2007-02-16 19:11:07 +0000 | [diff] [blame] | 24 | #if HAVE_SYS_RESOURCE_H |
| 25 | #include <sys/resource.h> |
| 26 | #endif |
Reid Spencer | cdf54d0 | 2004-12-27 06:16:52 +0000 | [diff] [blame] | 27 | #if HAVE_SIGNAL_H |
| 28 | #include <signal.h> |
| 29 | #endif |
| 30 | #if HAVE_FCNTL_H |
| 31 | #include <fcntl.h> |
| 32 | #endif |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 33 | |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 34 | namespace llvm { |
| 35 | using namespace sys; |
| 36 | |
Daniel Dunbar | defc853 | 2009-08-03 05:02:46 +0000 | [diff] [blame] | 37 | Program::Program() : Pid_(0) {} |
| 38 | |
| 39 | Program::~Program() {} |
| 40 | |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 41 | // This function just uses the PATH environment variable to find the program. |
Reid Spencer | 2565943 | 2004-09-13 21:48:44 +0000 | [diff] [blame] | 42 | Path |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 43 | Program::FindProgramByName(const std::string& progName) { |
| 44 | |
| 45 | // Check some degenerate cases |
| 46 | if (progName.length() == 0) // no program |
Reid Spencer | 2565943 | 2004-09-13 21:48:44 +0000 | [diff] [blame] | 47 | return Path(); |
| 48 | Path temp; |
Reid Spencer | dd04df0 | 2005-07-07 23:21:43 +0000 | [diff] [blame] | 49 | if (!temp.set(progName)) // invalid name |
Reid Spencer | 2565943 | 2004-09-13 21:48:44 +0000 | [diff] [blame] | 50 | return Path(); |
Benjamin Kramer | b0facb1 | 2009-07-28 22:08:15 +0000 | [diff] [blame] | 51 | // Use the given path verbatim if it contains any slashes; this matches |
| 52 | // the behavior of sh(1) and friends. |
Dan Gohman | a87861e | 2009-07-28 23:25:18 +0000 | [diff] [blame] | 53 | if (progName.find('/') != std::string::npos) |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 54 | return temp; |
| 55 | |
Dan Gohman | 88abb89 | 2009-08-05 17:32:39 +0000 | [diff] [blame] | 56 | // At this point, the file name does not contain slashes. Search for it |
| 57 | // through the directories specified in the PATH environment variable. |
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 |
Chris Lattner | 74382b7 | 2009-08-23 22:45:37 +0000 | [diff] [blame] | 100 | File = Path->str(); |
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 | |
Anton Korobeynikov | 9ba8a76 | 2007-02-16 19:11:07 +0000 | [diff] [blame] | 119 | static void SetMemoryLimits (unsigned size) |
| 120 | { |
| 121 | #if HAVE_SYS_RESOURCE_H |
| 122 | struct rlimit r; |
| 123 | __typeof__ (r.rlim_cur) limit = (__typeof__ (r.rlim_cur)) (size) * 1048576; |
| 124 | |
| 125 | // Heap size |
| 126 | getrlimit (RLIMIT_DATA, &r); |
| 127 | r.rlim_cur = limit; |
| 128 | setrlimit (RLIMIT_DATA, &r); |
Gabor Greif | aa6b7fd | 2007-07-06 10:31:27 +0000 | [diff] [blame] | 129 | #ifdef RLIMIT_RSS |
Anton Korobeynikov | 9ba8a76 | 2007-02-16 19:11:07 +0000 | [diff] [blame] | 130 | // Resident set size. |
| 131 | getrlimit (RLIMIT_RSS, &r); |
| 132 | r.rlim_cur = limit; |
| 133 | setrlimit (RLIMIT_RSS, &r); |
Reid Spencer | 2e40d03 | 2007-04-23 07:22:51 +0000 | [diff] [blame] | 134 | #endif |
Devang Patel | 69bdf68 | 2007-06-04 15:28:57 +0000 | [diff] [blame] | 135 | #ifdef RLIMIT_AS // e.g. NetBSD doesn't have it. |
Anton Korobeynikov | 9ba8a76 | 2007-02-16 19:11:07 +0000 | [diff] [blame] | 136 | // Virtual memory. |
| 137 | getrlimit (RLIMIT_AS, &r); |
| 138 | r.rlim_cur = limit; |
| 139 | setrlimit (RLIMIT_AS, &r); |
| 140 | #endif |
Devang Patel | 69bdf68 | 2007-06-04 15:28:57 +0000 | [diff] [blame] | 141 | #endif |
Anton Korobeynikov | 9ba8a76 | 2007-02-16 19:11:07 +0000 | [diff] [blame] | 142 | } |
| 143 | |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 144 | bool |
| 145 | Program::Execute(const Path& path, |
| 146 | const char** args, |
| 147 | const char** envp, |
| 148 | const Path** redirects, |
| 149 | unsigned memoryLimit, |
| 150 | std::string* ErrMsg) |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 151 | { |
| 152 | if (!path.canExecute()) { |
| 153 | if (ErrMsg) |
Chris Lattner | 74382b7 | 2009-08-23 22:45:37 +0000 | [diff] [blame] | 154 | *ErrMsg = path.str() + " is not executable"; |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 155 | return false; |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 156 | } |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 157 | |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 158 | // Create a child process. |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 159 | int child = fork(); |
| 160 | switch (child) { |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 161 | // An error occured: Return to the caller. |
| 162 | case -1: |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 163 | MakeErrMsg(ErrMsg, "Couldn't fork"); |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 164 | return false; |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 165 | |
| 166 | // Child process: Execute the program. |
Reid Spencer | e2e2411 | 2004-12-14 04:18:51 +0000 | [diff] [blame] | 167 | case 0: { |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 168 | // Redirect file descriptors... |
| 169 | if (redirects) { |
Matthijs Kooijman | cf45ca0 | 2008-06-12 12:53:35 +0000 | [diff] [blame] | 170 | // Redirect stdin |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 171 | if (RedirectIO(redirects[0], 0, ErrMsg)) { return false; } |
Matthijs Kooijman | cf45ca0 | 2008-06-12 12:53:35 +0000 | [diff] [blame] | 172 | // Redirect stdout |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 173 | if (RedirectIO(redirects[1], 1, ErrMsg)) { return false; } |
Mikhail Glushenkov | 234f689 | 2009-07-17 20:38:17 +0000 | [diff] [blame] | 174 | if (redirects[1] && redirects[2] && |
Matthijs Kooijman | cf45ca0 | 2008-06-12 12:53:35 +0000 | [diff] [blame] | 175 | *(redirects[1]) == *(redirects[2])) { |
| 176 | // If stdout and stderr should go to the same place, redirect stderr |
| 177 | // to the FD already open for stdout. |
| 178 | if (-1 == dup2(1,2)) { |
| 179 | MakeErrMsg(ErrMsg, "Can't redirect stderr to stdout"); |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 180 | return false; |
Matthijs Kooijman | cf45ca0 | 2008-06-12 12:53:35 +0000 | [diff] [blame] | 181 | } |
| 182 | } else { |
| 183 | // Just redirect stderr |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 184 | if (RedirectIO(redirects[2], 2, ErrMsg)) { return false; } |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 185 | } |
| 186 | } |
| 187 | |
Anton Korobeynikov | 9ba8a76 | 2007-02-16 19:11:07 +0000 | [diff] [blame] | 188 | // Set memory limits |
| 189 | if (memoryLimit!=0) { |
| 190 | SetMemoryLimits(memoryLimit); |
| 191 | } |
Mikhail Glushenkov | 234f689 | 2009-07-17 20:38:17 +0000 | [diff] [blame] | 192 | |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 193 | // Execute! |
Evan Cheng | 2fafaf1 | 2006-06-09 20:43:11 +0000 | [diff] [blame] | 194 | if (envp != 0) |
Daniel Dunbar | 6db0a8b | 2009-08-04 20:32:25 +0000 | [diff] [blame] | 195 | execve(path.c_str(), (char**)args, (char**)envp); |
Evan Cheng | 2fafaf1 | 2006-06-09 20:43:11 +0000 | [diff] [blame] | 196 | else |
Daniel Dunbar | 6db0a8b | 2009-08-04 20:32:25 +0000 | [diff] [blame] | 197 | execv(path.c_str(), (char**)args); |
Dan Gohman | 3396852 | 2009-08-05 00:09:12 +0000 | [diff] [blame] | 198 | // If the execve() failed, we should exit. Follow Unix protocol and |
| 199 | // return 127 if the executable was not found, and 126 otherwise. |
| 200 | // Use _exit rather than exit so that atexit functions and static |
| 201 | // object destructors cloned from the parent process aren't |
| 202 | // redundantly run, and so that any data buffered in stdio buffers |
| 203 | // cloned from the parent aren't redundantly written out. |
| 204 | _exit(errno == ENOENT ? 127 : 126); |
Reid Spencer | e2e2411 | 2004-12-14 04:18:51 +0000 | [diff] [blame] | 205 | } |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 206 | |
| 207 | // Parent process: Break out of the switch to do our processing. |
| 208 | default: |
| 209 | break; |
| 210 | } |
| 211 | |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 212 | Pid_ = child; |
| 213 | |
| 214 | return true; |
| 215 | } |
| 216 | |
| 217 | int |
| 218 | Program::Wait(unsigned secondsToWait, |
| 219 | std::string* ErrMsg) |
| 220 | { |
| 221 | #ifdef HAVE_SYS_WAIT_H |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 222 | struct sigaction Act, Old; |
| 223 | |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 224 | if (Pid_ == 0) { |
| 225 | MakeErrMsg(ErrMsg, "Process not started!"); |
| 226 | return -1; |
| 227 | } |
| 228 | |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 229 | // Install a timeout handler. |
| 230 | if (secondsToWait) { |
Duncan Sands | 3429c5e | 2009-09-07 05:58:25 +0000 | [diff] [blame^] | 231 | memset(&Act, 0, sizeof(Act)); |
| 232 | Act.sa_handler = SIG_IGN; |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 233 | sigemptyset(&Act.sa_mask); |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 234 | sigaction(SIGALRM, &Act, &Old); |
| 235 | alarm(secondsToWait); |
| 236 | } |
| 237 | |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 238 | // Parent process: Wait for the child process to terminate. |
| 239 | int status; |
Mikhail Glushenkov | 3140619 | 2009-07-18 21:43:12 +0000 | [diff] [blame] | 240 | int child = this->Pid_; |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 241 | while (wait(&status) != child) |
| 242 | if (secondsToWait && errno == EINTR) { |
| 243 | // Kill the child. |
| 244 | kill(child, SIGKILL); |
Mikhail Glushenkov | 234f689 | 2009-07-17 20:38:17 +0000 | [diff] [blame] | 245 | |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 246 | // Turn off the alarm and restore the signal handler |
| 247 | alarm(0); |
| 248 | sigaction(SIGALRM, &Old, 0); |
| 249 | |
| 250 | // Wait for child to die |
| 251 | if (wait(&status) != child) |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 252 | MakeErrMsg(ErrMsg, "Child timed out but wouldn't die"); |
Devang Patel | a1e4bba | 2008-02-04 20:57:54 +0000 | [diff] [blame] | 253 | else |
| 254 | MakeErrMsg(ErrMsg, "Child timed out", 0); |
| 255 | |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 256 | return -1; // Timeout detected |
Devang Patel | a1e4bba | 2008-02-04 20:57:54 +0000 | [diff] [blame] | 257 | } else if (errno != EINTR) { |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 258 | MakeErrMsg(ErrMsg, "Error waiting for child process"); |
| 259 | return -1; |
Reid Spencer | 2a7d9e9 | 2004-12-19 18:00:44 +0000 | [diff] [blame] | 260 | } |
| 261 | |
| 262 | // We exited normally without timeout, so turn off the timer. |
| 263 | if (secondsToWait) { |
| 264 | alarm(0); |
| 265 | sigaction(SIGALRM, &Old, 0); |
| 266 | } |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 267 | |
Reid Spencer | d555f41 | 2005-12-22 20:00:16 +0000 | [diff] [blame] | 268 | // Return the proper exit status. 0=success, >0 is programs' exit status, |
| 269 | // <0 means a signal was returned, -9999999 means the program dumped core. |
| 270 | int result = 0; |
Chris Lattner | 0228c0f | 2006-07-12 22:37:18 +0000 | [diff] [blame] | 271 | if (WIFEXITED(status)) |
Reid Spencer | d555f41 | 2005-12-22 20:00:16 +0000 | [diff] [blame] | 272 | result = WEXITSTATUS(status); |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 273 | else if (WIFSIGNALED(status)) |
Reid Spencer | d555f41 | 2005-12-22 20:00:16 +0000 | [diff] [blame] | 274 | result = 0 - WTERMSIG(status); |
| 275 | #ifdef WCOREDUMP |
Chris Lattner | 0228c0f | 2006-07-12 22:37:18 +0000 | [diff] [blame] | 276 | else if (WCOREDUMP(status)) |
Reid Spencer | d555f41 | 2005-12-22 20:00:16 +0000 | [diff] [blame] | 277 | result |= 0x01000000; |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 278 | #endif |
Reid Spencer | d555f41 | 2005-12-22 20:00:16 +0000 | [diff] [blame] | 279 | return result; |
| 280 | #else |
| 281 | return -99; |
| 282 | #endif |
Mikhail Glushenkov | 234f689 | 2009-07-17 20:38:17 +0000 | [diff] [blame] | 283 | |
Reid Spencer | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 284 | } |
| 285 | |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 286 | bool Program::ChangeStdinToBinary(){ |
Reid Spencer | 32f5553 | 2006-06-07 23:18:34 +0000 | [diff] [blame] | 287 | // Do nothing, as Unix doesn't differentiate between text and binary. |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 288 | return false; |
Reid Spencer | 32f5553 | 2006-06-07 23:18:34 +0000 | [diff] [blame] | 289 | } |
| 290 | |
Reid Spencer | 4ce5dc6 | 2006-08-21 06:02:44 +0000 | [diff] [blame] | 291 | bool Program::ChangeStdoutToBinary(){ |
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 | 52a7efa | 2004-08-29 19:20:41 +0000 | [diff] [blame] | 296 | } |