Changeset bc714da66961…
Parent 182f1db4e5ba…
by Andrew Pritchard <andrewp@fogcreek.com>
Changes to one file · Browse files at bc714da66961 Showing diff from parent 182f1db4e5ba Diff from another changeset...
@@ -427,21 +427,15 @@ util.makedirs(os.path.dirname(filename))
if os.path.exists(filename):
os.unlink(filename)
- if os.name == 'posix':
- # Yuck: on Unix, go through open(2) to ensure that the caller's mode is
- # filtered by umask() in the kernel, where it's supposed to be done.
- wfile = os.fdopen(os.open(filename, os.O_WRONLY|os.O_CREAT,
- getmode(executable)), 'wb')
- else:
- # But on Windows, use open() directly, since passing mode='wb' to
- # os.fdopen() does not work. (Python bug?)
- wfile = open(filename, 'wb')
+ wfile = open(filename, 'wb')
try:
wfile.write(hash)
wfile.write('\n')
finally:
wfile.close()
+ if os.path.exists(filename):
+ os.chmod(filename, getmode(executable))
def getexecutable(filename):
mode = os.stat(filename).st_mode
|
Loading...