# -*- coding: UTF-8 -*- import subprocess import os import time # fd 0继承 fd_null = os.open("/dev/null", os.O_RDWR) if fd_null != 0: os.close(0) os.dup2(fd_null,0) subprocess.call(["sleep", "12345"]) time.sleep(1234)