YouTip LogoYouTip

Python3 Os Tcsetpgrp

# Python3.x Python3 os.tcsetpgrp() Method [![Image 3: Python3 OS File/Directory Methods](#) Python3 OS File/Directory Methods](#) * * * ### Overview The os.tcsetpgrp() method is used to set the process group associated with terminal fd (an open file descriptor returned by os.open()) to pg. Available systems: Unix. ### Syntax The syntax for the **tcsetpgrp()** method is as follows: os.tcsetpgrp(fd, pg) ### Parameters * **fd** -- File descriptor. * **pg** -- Associated process group. ### Return Value This method does not return a value. ### Example The following example demonstrates the use of the tcsetpgrp() method: #!/usr/bin/python3import os, sys # Display the current directoryprint( "Current directory: %s" %os.getcwd() )# Change directory to /dev/tty fd = os.open("/dev/tty",os.O_RDONLY) f = os.tcgetpgrp(fd)# Display the process groupprint( "Associated process group: " )print( f )# Set the process group os.tcsetpgrp(fd,2672)print( "done" ) os.close(fd)print( "File closed successfully!!" ) The output of the above program is: Current directory: /tmp Associated process group: 2672doneFile closed successfully!! [![Image 4: Python3 OS File/Directory Methods](#) Python3 OS File/Directory Methods](#)
← Macos Docker InstallJsref Includes β†’