You are here : python_2osostcgetpgrp

os.tcgetpgrp() - os

             

The method tcgetpgrp() returns the process group associated with the terminal given by fd (an open file descriptor as returned by os.open())


  • fd -- This is the file descriptor.


Syntax


os.tcgetpgrp(fd)


Example


# !/usr/bin/python

import os, sys

# Showing current directory 
print "Current working dir :%s" %os.getcwd()

# Changing dir to /dev/tty
fd = os.open("/dev/tty",os.O_RDONLY)

f = os.tcgetpgrp(fd)

# Showing the process group
print "the process group associated is: "
print f

os.close(fd)
print "Closed the file successfully!!"


Output / Return Value

When we run above program, it produces following result:


Current working dir is :/tmp the process group associated is: 2670 Closed the file successfully!!


Limitations


Alternatives / See Also


Reference