GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

SIGCHLDEventHandler.handle()   B
last analyzed

Complexity

Conditions 4

Size

Total Lines 27

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
c 1
b 0
f 0
dl 0
loc 27
ccs 0
cts 13
cp 0
crap 20
rs 8.5806
1
"""
2
Enarksh
3
4
Copyright 2013-2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8
import os
9
10
from enarksh.controller.message.JobFinishedMessage import JobFinishedMessage
11
12
13
class SIGCHLDEventHandler:
14
    """
15
    An event handler when SIGCHLD has been received.
16
    """
17
18
    # ------------------------------------------------------------------------------------------------------------------
19
    @staticmethod
20
    def handle(_event, _event_data, spawner):
21
        """
22
        Handles an exit of a child and ends a job handler.
23
24
        :param * _event: Not used.
25
        :param * _event_data: Not used.
26
        :param enarksh.spawner.Spawner.Spawner spawner: The spawner.
27
        """
28
        del _event, _event_data
29
30
        try:
31
            pid = -1
32
            while pid != 0:
33
                pid, status = os.waitpid(-1, os.WNOHANG + os.WUNTRACED + os.WCONTINUED)
34
                if pid != 0:
35
                    job_handler = spawner.job_handlers[pid]
36
37
                    # Send message to controller that a job has finished.
38
                    message = JobFinishedMessage(job_handler.sch_id, job_handler.rnd_id, status)
39
                    message.send_message('controller')
40
41
                    # Inform the job handler the job has finished.
42
                    job_handler.set_job_has_finished()
43
        except OSError:
44
            # Ignore OSError. No more children to wait for.
45
            pass
46
47
# ----------------------------------------------------------------------------------------------------------------------
48