aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/tools/process-wrapper-legacy.h
diff options
context:
space:
mode:
authorGravatar elenairina <elenairina@google.com>2017-05-23 20:06:28 +0200
committerGravatar Irina Iancu <elenairina@google.com>2017-05-23 20:15:47 +0200
commit5608765ab737ebb8a98a04a6068143d53ae7065c (patch)
treedcfaf44eb0721369355e794de828f6a7d8451790 /src/main/tools/process-wrapper-legacy.h
parent6206d1edd5ec7b067daa48ce0c2b3784d0002c26 (diff)
Automated g4 rollback of commit 7f520a8286c39c5145b6d816cd0be5a6b7b18250.
*** Reason for rollback *** This broke Bazel CI on freebsd: http://ci.bazel.io/view/Dashboard/job/Bazel/JAVA_VERSION=1.8,PLATFORM_NAME=freebsd-11/1516/console# *** Original change description *** Refactor process-wrapper code so the spawn/wait code is pluggable. In an upcoming change I'll reintroduce the new platform-specific implementations that can kill and wait for all descendant processes spawned by the wrapped process. This has no functional changes. PiperOrigin-RevId: 156884488
Diffstat (limited to 'src/main/tools/process-wrapper-legacy.h')
-rw-r--r--src/main/tools/process-wrapper-legacy.h49
1 files changed, 0 insertions, 49 deletions
diff --git a/src/main/tools/process-wrapper-legacy.h b/src/main/tools/process-wrapper-legacy.h
deleted file mode 100644
index 5cea547175..0000000000
--- a/src/main/tools/process-wrapper-legacy.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2017 The Bazel Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef SRC_MAIN_TOOLS_PROCESS_WRAPPER_LEGACY_H_
-#define SRC_MAIN_TOOLS_PROCESS_WRAPPER_LEGACY_H_
-
-#include <signal.h>
-#include <vector>
-
-// The process-wrapper implementation that was used until and including Bazel
-// 0.4.5. Waits for the wrapped process to exit and then kills its process
-// group. Works on all POSIX operating systems (tested on Linux, macOS,
-// FreeBSD).
-//
-// Caveats:
-// - Killing just the process group of the spawned child means that daemons or
-// other processes spawned by the child may not be killed if they change their
-// process group.
-// - Does not wait for grandchildren to exit, thus processes spawned by the
-// child that could not be killed will linger around in the background.
-// - Has a PID reuse race condition, because the kill() to the process group is
-// sent after waitpid() was called on the main child.
-class LegacyProcessWrapper {
- public:
- // Run the command specified in the `opt.args` array and kill it after
- // `opt.timeout_secs` seconds.
- static void RunCommand();
-
- private:
- static void SpawnChild();
- static void WaitForChild();
- static void OnSignal(int sig);
-
- static pid_t child_pid;
- static volatile sig_atomic_t last_signal;
-};
-
-#endif