Debian Codegraph @

tests/data/pk-spawn-test-sigterm.py

raw
1 #!/usr/bin/env python3
2 #
3 # This program is distributed in the hope that it will be useful,
4 # but WITHOUT ANY WARRANTY; without even the implied warranty of
5 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 # GNU General Public License for more details.
7 #
8 # You should have received a copy of the GNU General Public License
9 # along with this program; if not, write to the Free Software
10 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
11
12 # Copyright (C) 2010 Richard Hughes <[email protected]>
13
14 from signal import *
15 from time import sleep
16 from sys import stdout
17
18 def process_term(signum, frame):
19 exit()
20
21 def main():
22 signal(SIGTERM, process_term)
23
24 for i in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]:
25 stdout.write("percentage\t%i\n" % (i * 10))
26 stdout.flush()
27 sleep(0.3)
28
29 if __name__ == "__main__":
30 main()