Clean up open() to be more pythonic

Project: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/commit/93628140
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/tree/93628140
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/diff/93628140

Branch: refs/heads/master
Commit: 936281403c38c6c3d502d8e57c684fd9f96c219f
Parents: 9e8a082
Author: Thomas Jackson <[email protected]>
Authored: Thu Jan 22 17:10:56 2015 -0800
Committer: Thomas Jackson <[email protected]>
Committed: Thu Jan 22 17:10:56 2015 -0800

----------------------------------------------------------------------
 tsqa/environment.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver-qa/blob/93628140/tsqa/environment.py
----------------------------------------------------------------------
diff --git a/tsqa/environment.py b/tsqa/environment.py
index 1d6e474..8cf5291 100644
--- a/tsqa/environment.py
+++ b/tsqa/environment.py
@@ -351,8 +351,7 @@ class Environment:
         os.chmod(os.path.join(self.layout.runtimedir), 0777)
 
         # write out a conveinence script to
-        fd = os.open(os.path.join(self.layout.prefix, 'run'), os.O_WRONLY | 
os.O_CREAT | os.O_TRUNC, 0755)
-        with os.fdopen(fd, 'w') as runscript:
+        with open(os.path.join(self.layout.prefix, 'run'), 'w') as runscript:
             runscript.write('#! /usr/bin/env sh\n\n')
             runscript.write('# run PROGRAM [ARGS ...]\n')
             runscript.write('# Run a Traffic Server program in this 
environment\n\n')

Reply via email to