mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-30 11:04:50 +00:00
Replace popen2 with subprocess
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3881 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
cb7254adbd
commit
a4bf58755b
1 changed files with 6 additions and 8 deletions
14
setup.py
14
setup.py
|
|
@ -24,7 +24,7 @@ if not (hasattr(sys, 'version_info') or
|
|||
sys.version_info < (2, 5, 0, 'final', 0)):
|
||||
raise SystemExit("This program requires Python 2.5 or later.")
|
||||
import os
|
||||
import popen2
|
||||
import subprocess
|
||||
import platform
|
||||
import stat
|
||||
import glob
|
||||
|
|
@ -293,13 +293,11 @@ def cc_supports_option (cc, option):
|
|||
@rtype: bool
|
||||
"""
|
||||
prog = "int main(){}\n"
|
||||
cc_cmd = "%s -E %s -" % (cc[0], option)
|
||||
pipe = popen2.Popen4(cc_cmd)
|
||||
pipe.tochild.write(prog)
|
||||
pipe.tochild.close()
|
||||
status = pipe.wait()
|
||||
if os.WIFEXITED(status):
|
||||
return os.WEXITSTATUS(status) == 0
|
||||
pipe = subprocess.Popen([cc[0], "-E", option, "-"],
|
||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)
|
||||
pipe.communicate(input=prog)
|
||||
if os.WIFEXITED(pipe.returncode):
|
||||
return os.WEXITSTATUS(pipe.returncode) == 0
|
||||
return False
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue