summaryrefslogtreecommitdiff
path: root/lib/System/Unix/Program.inc
Commit message (Collapse)AuthorAge
* Merge System into Support.Michael J. Spencer2010-11-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120298 91177308-0d34-0410-b5e6-96231b3b80d8
* Make FindProgramByName return paths with slashes unmodified on Windows.Mikhail Glushenkov2010-11-02
| | | | | | This makes its behaviour more consistent across platforms. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118048 91177308-0d34-0410-b5e6-96231b3b80d8
* Check if ErrMsg is null. This fixes the "not" command.Dan Gohman2010-10-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117666 91177308-0d34-0410-b5e6-96231b3b80d8
* Make Program::Wait differentiate execution failure due to the fileDan Gohman2010-10-29
| | | | | | | being not found from the file being not executable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117664 91177308-0d34-0410-b5e6-96231b3b80d8
* Make Program::Wait provide an error message string for errorsDan Gohman2010-10-29
| | | | | | | executing the child process and abnormal child process termination. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117661 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r117582, which reverted r77396. Searching PATH for a stringDan Gohman2010-10-28
| | | | | | | | | | | | | which contains slashes is inconsistent with the meaning of PATH on Unix-type platforms, and pretty surprising. If the user has given a specific path to execute and we can't execute it, we should fail and say why. (Apparently the new posix_spawn code doesn't always say why, but that's a separate issue.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117596 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r77396.Mikhail Glushenkov2010-10-28
| | | | | | | | | | | | | | Original commit message: On "Unix", if Program::FindProgramByName is given a name containing slashes, just go with it, regardless of whether it looks like it will be executable. This follows the behavior of sh(1) more closely. It's better when behaviour is consistent between platforms. This change also makes FindExecutable() behave as expected on unix-likes (before this commit, it used to always succeed). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117582 91177308-0d34-0410-b5e6-96231b3b80d8
* Trailing whitespace.Mikhail Glushenkov2010-10-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117581 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an explicit initialization to work around what appears to be a valgrindDaniel Dunbar2010-09-30
| | | | | | false positive, at least on Darwin. I haven't filed this, but you can feel free. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115242 91177308-0d34-0410-b5e6-96231b3b80d8
* Rather than using an ifdef on the target to zero out fields,Duncan Sands2010-07-14
| | | | | | | just use memset to zero the entire struct. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108330 91177308-0d34-0410-b5e6-96231b3b80d8
* add some triple for minix, patch by Kees van Reeuwijk from PR7582Chris Lattner2010-07-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107785 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix -Wcast-qual warnings.Dan Gohman2010-04-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101782 91177308-0d34-0410-b5e6-96231b3b80d8
* avoid temporary std::string in non posix_spawn path.Chris Lattner2010-04-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101723 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate temporary string.Benjamin Kramer2010-04-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101711 91177308-0d34-0410-b5e6-96231b3b80d8
* Properly inherit the environment on darwin where environ is not available ↵Benjamin Kramer2010-04-18
| | | | | | for shared libraries. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101710 91177308-0d34-0410-b5e6-96231b3b80d8
* This is horrible. Split the difference, and declare 'environ' on all non-DarwinNick Lewycky2010-04-18
| | | | | | | | platforms to unbreak the darwin and linux builds. The BSD folks should feel free to change the #if, if this breaks them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101703 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r101701, Darwin doesn't have 'environ'. Go figure.Nick Lewycky2010-04-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101702 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix linux build. posix_spawn doesn't inherit the environment by default.Nick Lewycky2010-04-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101701 91177308-0d34-0410-b5e6-96231b3b80d8
* make Program::Execute use posix_spawn on systems that support it,Chris Lattner2010-04-18
| | | | | | | | | | | as it is more efficient than fork/exec. Thanks to Eric for adding the autoconf check. It would be nice if a cmake guru could add a cmake check for posix_spawn as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101693 91177308-0d34-0410-b5e6-96231b3b80d8
* improve haiku portability, patch by Paul Davey.Chris Lattner2010-04-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100933 91177308-0d34-0410-b5e6-96231b3b80d8
* don't forget to close a FD on an error condition, found byChris Lattner2010-03-14
| | | | | | | cppcheck, PR6617. Patch by Ettl Martin! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98525 91177308-0d34-0410-b5e6-96231b3b80d8
* improve support for minix, PR6280, patch byChris Lattner2010-02-12
| | | | | | | Kees van Reeuwijk! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95946 91177308-0d34-0410-b5e6-96231b3b80d8
* Add llvm::Program::ChangeStderrToBinary().Douglas Gregor2010-01-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94743 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert commit 81144, and add a comment. It caused bugpoint timeoutsDuncan Sands2009-11-08
| | | | | | | not to work any more on linux. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86481 91177308-0d34-0410-b5e6-96231b3b80d8
* Use 'waitpid' instead of 'wait'. Basing Program::Wait() on 'wait()' ↵Ted Kremenek2009-10-22
| | | | | | | | | | | | prevents it being correct within a multithreaded context. This address: PR 5277 (Program::Wait is unsafe to call from multiple threads). Note: If waitpid() turns out to be non-portable, we can add more autoconf magic, or look into another solution. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84903 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Get rid of GetProcessId in Win32/Program.inc.", this breaksDaniel Dunbar2009-09-22
| | | | | | ExecuteAndWait. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82522 91177308-0d34-0410-b5e6-96231b3b80d8
* Get rid of GetProcessId in Win32/Program.inc.Mikhail Glushenkov2009-09-15
| | | | | | | GetProcessId was introduced only in XP. As a bonus, this change makes Program objects copyable, since Program is now basically a PID. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81826 91177308-0d34-0410-b5e6-96231b3b80d8
* Check that the 'kill' call succeeded.Mikhail Glushenkov2009-09-09
| | | | | | Thanks to Duncan Sands for spotting this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81328 91177308-0d34-0410-b5e6-96231b3b80d8
* This should unbreak the build on 64-bit Linux.Mikhail Glushenkov2009-09-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81252 91177308-0d34-0410-b5e6-96231b3b80d8
* Const-correctness.Mikhail Glushenkov2009-09-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81249 91177308-0d34-0410-b5e6-96231b3b80d8
* Get rid of the Pid_ member in the Program class.Mikhail Glushenkov2009-09-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81247 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a Kill() function to the Program class.Mikhail Glushenkov2009-09-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81246 91177308-0d34-0410-b5e6-96231b3b80d8
* Using a signal handler that does nothing should beDuncan Sands2009-09-07
| | | | | | | equivalent to SIG_IGN. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81144 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove some not-really-used variables, as warnedDuncan Sands2009-09-06
| | | | | | | about by icc (#593, partial). Patch by Erick Tryzelaar. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81115 91177308-0d34-0410-b5e6-96231b3b80d8
* Prune #includes from llvm/Linker.h and llvm/System/Path.h,Chris Lattner2009-08-23
| | | | | | | | | | | | | | | | | | | | forcing them down into various .cpp files. This change also: 1. Renames TimeValue::toString() and Path::toString() to ::str() for similarity with the STL. 2. Removes all stream insertion support for sys::Path, forcing clients to call .str(). 3. Removes a use of Config/alloca.h from bugpoint, using smallvector instead. 4. Weans llvm-db off <iostream> sys::Path really needs to be gutted, but I don't have the desire to do it at this point. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79869 91177308-0d34-0410-b5e6-96231b3b80d8
* Update a comment to reflect the current code.Dan Gohman2009-08-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78215 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove needless uses of std::flush in the parent process after aDan Gohman2009-08-05
| | | | | | | | fork call. This eliminates a need for <iostream>. Also remove needless fsync calls. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78131 91177308-0d34-0410-b5e6-96231b3b80d8
* Use _exit rather than exit in the child process after a failed exec.Dan Gohman2009-08-05
| | | | | | | Add a comment explaining why. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78128 91177308-0d34-0410-b5e6-96231b3b80d8
* Follow Unix behavior and return 127 if the command is not found,Dan Gohman2009-08-04
| | | | | | | and 126 if it is not executable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78120 91177308-0d34-0410-b5e6-96231b3b80d8
* When exec() fails, return 127 instead of errno; the parent process has no way toDaniel Dunbar2009-08-04
| | | | | | | | distinguish that the result is errno, so it can't use it to provide more information about the error (it also exposes the numeric value of errno). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78098 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a race condition in getting the process exit code on Win32.Daniel Dunbar2009-08-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77953 91177308-0d34-0410-b5e6-96231b3b80d8
* On "Unix", if Program::FindProgramByName is given a name containingDan Gohman2009-07-28
| | | | | | | | slashes, just go with it, regardless of whether it looks like it will be executable. This follows the behavior of sh(1) more closely. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77396 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a fixme; don't take binaries from the working directory.Benjamin Kramer2009-07-28
| | | | | | | | This fixes clang on non-darwin platforms if a file called 'ld' or 'as' is in the working directory. Based on patch by Pawel Worach! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77379 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove duplication in Program::Execute{And,No}Wait.Mikhail Glushenkov2009-07-18
| | | | | | | Implemented by moving the code out of static functions into methods of Program class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76340 91177308-0d34-0410-b5e6-96231b3b80d8
* Trailing whitespace.Mikhail Glushenkov2009-07-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76229 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an ExecuteNoWait interface to support asynchronous process spawning.David Greene2009-07-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75055 91177308-0d34-0410-b5e6-96231b3b80d8
* Make Unix.h:MakeErrMsg separate the prefix and errno string, so we get:Daniel Dunbar2009-04-20
| | | | | | | | | | | | | | | | | | clang: error: unable to make temporary file: /etc/cc: can't make unique filename: Permission denied instead of clang: error: unable to make temporary file: /etc/cc: can't make unique filenamePermission denied for example. Also, audited the uses of MakeErrMsg to make the prefix strings consistent (not end with newline/punctuation/space/": "). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69626 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix redirection of stderr in sys::Program::ExecuteAndWait. There was logicMatthijs Kooijman2008-06-12
| | | | | | | | | | | | | | error that caused it to redirect stderr to stdout too often. This fix is applied identically to the win32 code as well, but that is untested. --Thi line, and those below, will be ignored-- M System/Unix/Program.inc M System/Win32/Program.inc git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52233 91177308-0d34-0410-b5e6-96231b3b80d8
* Make I/O redirection handling in sys::Program a bit more consistent. NoMatthijs Kooijman2008-06-12
| | | | | | | | | | | | | | functional changes. Win32 code is untested, but should work fine. In the unix variant, rename RedirectFD to RedirectIO and let that function handle empty and null paths instead of doing that in the caller 3 times. This is the same as win32 already does it. In the win32 variant, use Path::isEmpty() instead of checking the resulting c_str() manually. This is the same as unix already does it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52230 91177308-0d34-0410-b5e6-96231b3b80d8
* Unbreak build.Bill Wendling2008-05-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51709 91177308-0d34-0410-b5e6-96231b3b80d8