mirror of
https://github.com/munki/munki.git
synced 2026-04-26 15:00:08 -05:00
When writing out an embedded script before running it, write it a line at a time to ensure line endings are UNIX-style.
This commit is contained in:
@@ -2617,7 +2617,9 @@ def writefile(stringdata, path):
|
||||
Returns the path on success, empty string on failure.'''
|
||||
try:
|
||||
fileobject = open(path, mode='w', buffering=1)
|
||||
print >> fileobject, stringdata.encode('UTF-8')
|
||||
# write line-by-line to ensure proper UNIX line-endings
|
||||
for line in stringdata.splitlines():
|
||||
print >> fileobject, line.encode('UTF-8')
|
||||
fileobject.close()
|
||||
return path
|
||||
except (OSError, IOError):
|
||||
|
||||
Reference in New Issue
Block a user