PYTHON

python shell command

고요한하늘... 2012. 11. 7. 13:22


shell script를 실행시키고 해당 스크립트를 실행한 process가 끝나길 기다릴때 proc.wait()를 사용


command="ls -al"

proc = subprocess.Popen( command, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE )

                        return_code = proc.wait()

                        if return_code == 0 :