Python os.wait3() Examples

The following are code examples for showing how to use os.wait3(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: NiujiaoDebugger   Author: MrSrc   File: test_wait3.py    GNU General Public License v3.0 6 votes vote down vote up
def wait_impl(self, cpid):
        # This many iterations can be required, since some previously run
        # tests (e.g. test_ctypes) could have spawned a lot of children
        # very quickly.
        deadline = time.monotonic() + 10.0
        while time.monotonic() <= deadline:
            # wait3() shouldn't hang, but some of the buildbots seem to hang
            # in the forking tests.  This is an attempt to fix the problem.
            spid, status, rusage = os.wait3(os.WNOHANG)
            if spid == cpid:
                break
            time.sleep(0.1)

        self.assertEqual(spid, cpid)
        self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
        self.assertTrue(rusage) 
Example 2
Project: cqp-sdk-for-py37-native   Author: crud-boy   File: test_wait3.py    GNU General Public License v2.0 6 votes vote down vote up
def wait_impl(self, cpid):
        # This many iterations can be required, since some previously run
        # tests (e.g. test_ctypes) could have spawned a lot of children
        # very quickly.
        deadline = time.monotonic() + 10.0
        while time.monotonic() <= deadline:
            # wait3() shouldn't hang, but some of the buildbots seem to hang
            # in the forking tests.  This is an attempt to fix the problem.
            spid, status, rusage = os.wait3(os.WNOHANG)
            if spid == cpid:
                break
            time.sleep(0.1)

        self.assertEqual(spid, cpid)
        self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
        self.assertTrue(rusage) 
Example 3
Project: TFTHelper   Author: AliMZaini   File: loop.py    MIT License 6 votes vote down vote up
def _sigchld_callback(self):
        # Signals can arrive at (relatively) any time. To eliminate
        # race conditions, and behave more like libev, we "queue"
        # sigchld to run when we run callbacks.
        while True:
            try:
                pid, status, _usage = os.wait3(os.WNOHANG)
            except OSError:
                # Python 3 raises ChildProcessError
                break

            if pid == 0:
                break
            children_watchers = self._child_watchers.get(pid, []) + self._child_watchers.get(0, [])
            for watcher in children_watchers:
                self.run_callback(watcher._set_waitpid_status, pid, status)

            # Don't invoke child watchers for 0 more than once
            self._child_watchers[0] = [] 
Example 4
Project: sshplus   Author: NoXPhasma   File: sshplus.py    GNU General Public License v3.0 6 votes vote down vote up
def menuitem_response(w, item):
    if item == '_about':
        show_help_dlg(_ABOUT_TXT)
    elif item == '_edit':
        edit_config_file()
    elif item == '_refresh':
        newmenu = build_menu()
        ind.set_menu(newmenu)
        notify2.init("sshplus")
        notify2.Notification("SSHplus refreshed", "\"%s\" has been read! Menu list was refreshed!" % _SETTINGS_FILE).show()
    elif item == '_quit': 
        sys.exit(0)
    elif item == 'folder':
        pass
    else:
        print (item)
        os.spawnvp(os.P_NOWAIT, item['cmd'], [item['cmd']] + item['args'])
        os.wait3(os.WNOHANG) 
Example 5
Project: Project-New-Reign---Nemesis-Main   Author: ShikyoKira   File: test_wait3.py    GNU General Public License v3.0 6 votes vote down vote up
def wait_impl(self, cpid):
        # This many iterations can be required, since some previously run
        # tests (e.g. test_ctypes) could have spawned a lot of children
        # very quickly.
        deadline = time.monotonic() + 10.0
        while time.monotonic() <= deadline:
            # wait3() shouldn't hang, but some of the buildbots seem to hang
            # in the forking tests.  This is an attempt to fix the problem.
            spid, status, rusage = os.wait3(os.WNOHANG)
            if spid == cpid:
                break
            time.sleep(0.1)

        self.assertEqual(spid, cpid)
        self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
        self.assertTrue(rusage) 
Example 6
Project: cells   Author: AlesTsurko   File: test_wait3.py    MIT License 6 votes vote down vote up
def wait_impl(self, cpid):
        # This many iterations can be required, since some previously run
        # tests (e.g. test_ctypes) could have spawned a lot of children
        # very quickly.
        deadline = time.monotonic() + 10.0
        while time.monotonic() <= deadline:
            # wait3() shouldn't hang, but some of the buildbots seem to hang
            # in the forking tests.  This is an attempt to fix the problem.
            spid, status, rusage = os.wait3(os.WNOHANG)
            if spid == cpid:
                break
            time.sleep(0.1)

        self.assertEqual(spid, cpid)
        self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
        self.assertTrue(rusage) 
Example 7
Project: pyblish-win   Author: pyblish   File: test_wait3.py    GNU Lesser General Public License v3.0 5 votes vote down vote up
def wait_impl(self, cpid):
        for i in range(10):
            # wait3() shouldn't hang, but some of the buildbots seem to hang
            # in the forking tests.  This is an attempt to fix the problem.
            spid, status, rusage = os.wait3(os.WNOHANG)
            if spid == cpid:
                break
            time.sleep(1.0)

        self.assertEqual(spid, cpid)
        self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
        self.assertTrue(rusage) 
Example 8
Project: NiujiaoDebugger   Author: MrSrc   File: eintr_tester.py    GNU General Public License v3.0 5 votes vote down vote up
def test_wait3(self):
        self._test_wait_multiple(lambda: os.wait3(0)) 
Example 9
Project: dockerizeme   Author: dockerizeme   File: snippet.py    Apache License 2.0 5 votes vote down vote up
def menuitem_response(w, item):
    if item == '_about':
        show_help_dlg(_ABOUT_TXT)
    elif item == '_refresh':
        newmenu = build_menu()
        ind.set_menu(newmenu)
        pynotify.Notification("SSHplus refreshed", "Menu list was refreshed from %s" % _SETTINGS_FILE).show()
    elif item == '_quit':
        sys.exit(0)
    elif item == 'folder':
        pass
    else:
        print item
        os.spawnvp(os.P_NOWAIT, item['cmd'], [item['cmd']] + item['args'])
        os.wait3(os.WNOHANG) 
Example 10
Project: ironpython2   Author: IronLanguages   File: test_wait3.py    Apache License 2.0 5 votes vote down vote up
def wait_impl(self, cpid):
        for i in range(10):
            # wait3() shouldn't hang, but some of the buildbots seem to hang
            # in the forking tests.  This is an attempt to fix the problem.
            spid, status, rusage = os.wait3(os.WNOHANG)
            if spid == cpid:
                break
            time.sleep(1.0)

        self.assertEqual(spid, cpid)
        self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
        self.assertTrue(rusage) 
Example 11
Project: Blockly-rduino-communication   Author: technologiescollege   File: test_wait3.py    GNU General Public License v3.0 5 votes vote down vote up
def wait_impl(self, cpid):
        # This many iterations can be required, since some previously run
        # tests (e.g. test_ctypes) could have spawned a lot of children
        # very quickly.
        for i in range(30):
            # wait3() shouldn't hang, but some of the buildbots seem to hang
            # in the forking tests.  This is an attempt to fix the problem.
            spid, status, rusage = os.wait3(os.WNOHANG)
            if spid == cpid:
                break
            time.sleep(0.1)

        self.assertEqual(spid, cpid)
        self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
        self.assertTrue(rusage) 
Example 12
Project: cqp-sdk-for-py37-native   Author: crud-boy   File: eintr_tester.py    GNU General Public License v2.0 5 votes vote down vote up
def test_wait3(self):
        self._test_wait_multiple(lambda: os.wait3(0)) 
Example 13
Project: oss-ftp   Author: aliyun   File: test_wait3.py    MIT License 5 votes vote down vote up
def wait_impl(self, cpid):
        for i in range(10):
            # wait3() shouldn't hang, but some of the buildbots seem to hang
            # in the forking tests.  This is an attempt to fix the problem.
            spid, status, rusage = os.wait3(os.WNOHANG)
            if spid == cpid:
                break
            time.sleep(1.0)

        self.assertEqual(spid, cpid)
        self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
        self.assertTrue(rusage) 
Example 14
Project: sshplus   Author: NoXPhasma   File: sshplus.py    GNU General Public License v3.0 5 votes vote down vote up
def edit_config_file():
    if os.path.isfile(_SETTINGS_FILE) != True:
        os.mknod(_SETTINGS_FILE)
        show_help_dlg("<b>No <i>.sshplus</i> config file found, we created one for you!\n\nPlease edit the file and reload the config.</b>\n\n%s" % \
             _EDIT_CONFIG, error=True)
    os.spawnvp(os.P_NOWAIT, 'xdg-open', ['xdg-open', _SETTINGS_FILE])
    os.wait3(os.WNOHANG) 
Example 15
Project: Hot   Author: dsolimando   File: test_wait3.py    GNU General Public License v3.0 5 votes vote down vote up
def wait_impl(self, cpid):
        for i in range(10):
            # wait3() shouldn't hang, but some of the buildbots seem to hang
            # in the forking tests.  This is an attempt to fix the problem.
            spid, status, rusage = os.wait3(os.WNOHANG)
            if spid == cpid:
                break
            time.sleep(1.0)

        self.assertEqual(spid, cpid)
        self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
        self.assertTrue(rusage) 
Example 16
Project: Project-New-Reign---Nemesis-Main   Author: ShikyoKira   File: eintr_tester.py    GNU General Public License v3.0 5 votes vote down vote up
def test_wait3(self):
        self._test_wait_multiple(lambda: os.wait3(0)) 
Example 17
Project: cells   Author: AlesTsurko   File: eintr_tester.py    MIT License 5 votes vote down vote up
def test_wait3(self):
        self._test_wait_multiple(lambda: os.wait3(0))