Skip to content

Commit 07f7025

Browse files
authored
Merge pull request #242 from kevinhwang91/avoid-zombie
avoid producing zombie processes
2 parents 7a5dd3a + feb768a commit 07f7025

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

libinput-gestures

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
#!/usr/bin/env python3
22
'Read gestures from libinput touchpad and action shell commands.'
33
# Mark Blakeney, Sep 2015
4-
import os, sys, argparse, subprocess, shlex, re, getpass, fcntl, platform, math
4+
import os
5+
import sys
6+
import argparse
7+
import subprocess
8+
import shlex
9+
import re
10+
import getpass
11+
import fcntl
12+
import platform
13+
import math
14+
import signal
515
from time import monotonic
616
from collections import OrderedDict
717
from pathlib import Path
@@ -704,6 +714,9 @@ def main():
704714
cmd = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE,
705715
bufsize=1, universal_newlines=True)
706716

717+
# Avoid producing zombie processes
718+
signal.signal(signal.SIGCHLD, signal.SIG_IGN)
719+
707720
# Sit in a loop forever reading the libinput messages ..
708721
handler = None
709722
for line in cmd.stdout:

0 commit comments

Comments
 (0)