summaryrefslogtreecommitdiffstats
path: root/test/Rpcgen/RPCGENCLIENTFLAGS.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/Rpcgen/RPCGENCLIENTFLAGS.py')
-rw-r--r--test/Rpcgen/RPCGENCLIENTFLAGS.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/test/Rpcgen/RPCGENCLIENTFLAGS.py b/test/Rpcgen/RPCGENCLIENTFLAGS.py
index 9612952..a298ebd 100644
--- a/test/Rpcgen/RPCGENCLIENTFLAGS.py
+++ b/test/Rpcgen/RPCGENCLIENTFLAGS.py
@@ -38,12 +38,13 @@ import getopt
import sys
cmd_opts, args = getopt.getopt(sys.argv[1:], 'chlmo:x', [])
for opt, arg in cmd_opts:
- if opt == '-o': output = open(arg, 'w')
-output.write(" ".join(sys.argv) + "\\n")
-for a in args:
- contents = open(a, 'r').read()
- output.write(contents.replace('RPCGEN', 'myrpcgen.py'))
-output.close()
+ if opt == '-o': out = arg
+with open(out, 'w') as ofp:
+ ofp.write(" ".join(sys.argv) + "\\n")
+ for a in args:
+ with open(a, 'r') as ifp:
+ contents = ifp.read()
+ ofp.write(contents.replace('RPCGEN', 'myrpcgen.py'))
sys.exit(0)
""")