Python os.tcsetpgrp() Examples
The following are 11
code examples of os.tcsetpgrp().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
os
, or try the search function
.
Example #1
Source File: test_os.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_tcsetpgrpt(self): self.check(os.tcsetpgrp, 0)
Example #2
Source File: test_os.py From BinderFilter with MIT License | 5 votes |
def test_tcsetpgrpt(self): if hasattr(os, "tcsetpgrp"): self.check(os.tcsetpgrp, 0)
Example #3
Source File: test_os.py From oss-ftp with MIT License | 5 votes |
def test_tcsetpgrpt(self): self.check(os.tcsetpgrp, 0)
Example #4
Source File: test_os.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def test_tcsetpgrpt(self): self.check(os.tcsetpgrp, 0)
Example #5
Source File: test_os.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_tcsetpgrpt(self): self.check(os.tcsetpgrp, 0)
Example #6
Source File: test_os.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_tcsetpgrpt(self): self.check(os.tcsetpgrp, 0)
Example #7
Source File: test_os.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_tcsetpgrpt(self): self.check(os.tcsetpgrp, 0)
Example #8
Source File: logger.py From conary with Apache License 2.0 | 5 votes |
def _controlTerminal(self): try: # the child should control stdin -- if stdin is a tty # that can be controlled if sys.stdin.isatty(): os.tcsetpgrp(0, os.getpgrp()) except AttributeError: # stdin might not even have an isatty method pass
Example #9
Source File: test_os.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_tcsetpgrpt(self): if hasattr(os, "tcsetpgrp"): self.check(os.tcsetpgrp, 0)
Example #10
Source File: test_os.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_tcsetpgrpt(self): if hasattr(os, "tcsetpgrp"): self.check(os.tcsetpgrp, 0)
Example #11
Source File: logger.py From conary with Apache License 2.0 | 4 votes |
def close(self): """ Reassert control of tty. Closing stdin, stderr, and and stdout will get rid of the last pointer to the slave fd of the pseudo tty, which should cause the logging process to stop. We wait for it to die before continuing """ if not self.logging: return self.closed = True # restore old terminal settings before quitting if self.oldStdin != 0: os.dup2(self.oldStdin, 0) os.dup2(self.oldStdout, 1) os.dup2(self.oldStderr, 2) if self.oldTermios is not None: termios.tcsetattr(0, termios.TCSADRAIN, self.oldTermios) if self.oldStdin != 0: os.close(self.oldStdin) os.close(self.oldStdout) os.close(self.oldStderr) try: # control stdin -- if stdin is a tty # that can be controlled if sys.stdin.isatty() and self.restoreTerminalControl: os.tcsetpgrp(0, os.getpgrp()) except AttributeError: # stdin might not even have an isatty method pass # Wait for child logging process to die. Send successively ruder # signals if it does not do so within a reasonable time. The primary # reason that it would not die immediately is that a process has forked # while holding the TTY file descriptor, and thus the logger is still # polling it for output. signals = [signal.SIGTERM, signal.SIGKILL] while signals: start = time.time() while time.time() - start < 10: pid, status = os.waitpid(self.loggerPid, os.WNOHANG) if pid: break time.sleep(0.1) else: # Child process did not die. signum = signals.pop(0) os.kill(self.loggerPid, signum) continue break else: # Last signal was a KILL, so wait indefinitely. os.waitpid(self.loggerPid, 0)