diff options
Diffstat (limited to 'test/no-arguments.py')
-rw-r--r-- | test/no-arguments.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/no-arguments.py b/test/no-arguments.py index 953d827..8925c48 100644 --- a/test/no-arguments.py +++ b/test/no-arguments.py @@ -41,10 +41,10 @@ def cat(env, source, target): target = str(target[0]) source = list(map(str, source)) print('cat(%s) > %s' % (source, target)) - f = open(target, "wb") - for src in source: - f.write(open(src, "rb").read()) - f.close() + with open(target, "wb") as f: + for src in source: + with open(src, "rb") as ifp: + f.write(ifp.read()) env = Environment(BUILDERS={'Build':Builder(action=cat)}) env.Build('aaa.out', 'aaa.in') |