Python os.tcsetpgrp() 方法将与给定文件描述符表示的终端关联的进程组 ID 设置为整数值。此文件描述符是通过 “os.open()” 方法获取的。
注意:在 UNIX 等操作系统中,每个进程都属于一个特定的进程组。
语法
以下是 Python os.tcsetpgrp() 方法的语法 -
参数
Python os.tcsetpgrp() 方法接受以下参数 -
- fd − 这是文件描述符。
- pg − 这会将进程组设置为 pg。
返回值
Python os.tcsetpgrp() 方法不返回任何值。
例以下示例显示了 tcsetpgrp() 方法的用法。
当我们运行上述程序时,它会产生以下结果——
Current working dir is :/tmp
the process group associated is:
2672
done
Closed the file successfully!!
the process group associated is:
2672
done
Closed the file successfully!!