From: Agnibho Mondal Date: Tue, 13 Mar 2018 07:02:07 +0000 (+0530) Subject: Replaced deprecated os.popen X-Git-Url: https://code.agnibho.com/repo?a=commitdiff_plain;h=76b6484bba81580493eedcb76c10d3123f7eadd9;p=statin.git Replaced deprecated os.popen --- diff --git a/statin/statin.py b/statin/statin.py index 3827a93..43f86b4 100644 --- a/statin/statin.py +++ b/statin/statin.py @@ -112,7 +112,7 @@ def main(): except FileNotFoundError: if(not args.quiet): print(args.before + ": command not recognized") - else: + except: if(args.verbose): print(args.before + ": command failed") @@ -169,7 +169,7 @@ def main(): except FileNotFoundError: if(not args.quiet): print(args.after + ": command not recognized") - else: + except: if(args.verbose): print(args.after + ": command failed") @@ -290,11 +290,11 @@ def process_directive(line, filename): print(" Can't execute command in safe mode") return(conflist["errmsg"]) try: - return(popen(params["cmd"]).read()) + return(run(params["cmd"].split(), stdout=PIPE, encoding="utf-8").stdout) except KeyError: pass try: - return(popen(params["cgi"]).read()) + return(run(params["cgi"].split(), stdout=PIPE, encoding="utf-8").stdout) except KeyError: pass if(args.verbose):