f
This commit is contained in:
@@ -696,16 +696,22 @@ def main():
|
||||
action="store_true",
|
||||
help="Shut down if parent process dies"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--parent-pid",
|
||||
type=int,
|
||||
default=None,
|
||||
help="Explicit PID to monitor (defaults to the immediate parent process)",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Start monitor thread if requested
|
||||
if args.monitor:
|
||||
ppid = os.getppid()
|
||||
if ppid > 1:
|
||||
monitor_pid = args.parent_pid or os.getppid()
|
||||
if monitor_pid > 1:
|
||||
monitor_thread = threading.Thread(
|
||||
target=monitor_parent,
|
||||
args=(ppid, ),
|
||||
args=(monitor_pid, ),
|
||||
daemon=True
|
||||
)
|
||||
monitor_thread.start()
|
||||
|
||||
Reference in New Issue
Block a user