aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Unix/Program.inc
diff options
context:
space:
mode:
authorcpsughrue <cpsughrue@gmail.com>2024-02-26 21:40:21 -0500
committercpsughrue <cpsughrue@gmail.com>2024-02-26 21:40:21 -0500
commitf410f74cd5b26319b5796e0404c6a0f3b5cc00a5 (patch)
tree1d97c6220f59cfd32256a694bec1020d42475c01 /llvm/lib/Support/Unix/Program.inc
parentef7417fbc597eab1adbad4abc6ecdb2e62319513 (diff)
downloadllvm-f410f74cd5b26319b5796e0404c6a0f3b5cc00a5.zip
llvm-f410f74cd5b26319b5796e0404c6a0f3b5cc00a5.tar.gz
llvm-f410f74cd5b26319b5796e0404c6a0f3b5cc00a5.tar.bz2
Revert "[llvm][Support] Add support for executing a detached process (#81708)"
This reverts commit 86f6caa562255f81b93e72a501a926b17f5ad244. Unit test was failing on a few windows build bots
Diffstat (limited to 'llvm/lib/Support/Unix/Program.inc')
-rw-r--r--llvm/lib/Support/Unix/Program.inc18
1 files changed, 4 insertions, 14 deletions
diff --git a/llvm/lib/Support/Unix/Program.inc b/llvm/lib/Support/Unix/Program.inc
index 2742734..5d9757b 100644
--- a/llvm/lib/Support/Unix/Program.inc
+++ b/llvm/lib/Support/Unix/Program.inc
@@ -173,11 +173,10 @@ toNullTerminatedCStringArray(ArrayRef<StringRef> Strings, StringSaver &Saver) {
}
static bool Execute(ProcessInfo &PI, StringRef Program,
- ArrayRef<StringRef> Args,
- std::optional<ArrayRef<StringRef>> Env,
+ ArrayRef<StringRef> Args, std::optional<ArrayRef<StringRef>> Env,
ArrayRef<std::optional<StringRef>> Redirects,
unsigned MemoryLimit, std::string *ErrMsg,
- BitVector *AffinityMask, bool DetachProcess) {
+ BitVector *AffinityMask) {
if (!llvm::sys::fs::exists(Program)) {
if (ErrMsg)
*ErrMsg = std::string("Executable \"") + Program.str() +
@@ -203,8 +202,7 @@ static bool Execute(ProcessInfo &PI, StringRef Program,
// If this OS has posix_spawn and there is no memory limit being implied, use
// posix_spawn. It is more efficient than fork/exec.
#ifdef HAVE_POSIX_SPAWN
- // Cannot use posix_spawn if you would like to detach the process
- if (MemoryLimit == 0 && !DetachProcess) {
+ if (MemoryLimit == 0) {
posix_spawn_file_actions_t FileActionsStore;
posix_spawn_file_actions_t *FileActions = nullptr;
@@ -272,7 +270,7 @@ static bool Execute(ProcessInfo &PI, StringRef Program,
return true;
}
-#endif // HAVE_POSIX_SPAWN
+#endif
// Create a child process.
int child = fork();
@@ -309,14 +307,6 @@ static bool Execute(ProcessInfo &PI, StringRef Program,
}
}
- if (DetachProcess) {
- // Detach from controlling terminal
- if (::setsid() == -1) {
- MakeErrMsg(ErrMsg, "Could not detach process, ::setsid failed");
- return false;
- }
- }
-
// Set memory limits
if (MemoryLimit != 0) {
SetMemoryLimits(MemoryLimit);