Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9feb091

Browse files
committed
devnull hack for 2.7
1 parentb32db82 commit9feb091

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

‎testgres/testgres.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -965,26 +965,20 @@ def _execute_utility(util, args, logfile, write_to_pipe=True):
965965
stdout of executed utility.
966966
"""
967967

968-
withopen(logfile,"a")asfile_out:
969-
stdout_file=subprocess.DEVNULL
970-
stderr_file=subprocess.DEVNULL
968+
withopen(logfile,"a")asfile_out, \
969+
open(os.devnull,"w")asdevnull:# hack for 2.7
971970

972-
ifwrite_to_pipe:
973-
stdout_file=subprocess.PIPE
974-
stderr_file=subprocess.STDOUT
971+
# choose file according to options
972+
stdout_file=subprocess.PIPEifwrite_to_pipeelsedevnull
975973

976974
# run utility
977975
process=subprocess.Popen([get_bin_path(util)]+args,
978976
stdout=stdout_file,
979-
stderr=stderr_file)
977+
stderr=subprocess.STDOUT)
980978

981979
# get result
982980
out,_=process.communicate()
983-
984-
ifout:
985-
out=out.decode('utf-8')
986-
else:
987-
out=""
981+
out=''ifnotoutelseout.decode('utf-8')
988982

989983
# write new log entry
990984
file_out.write(''.join(map(lambdax:str(x)+' ', [util]+args)))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp