Show More
@@ -33,5 +33,11 b' def wait_file(path, timeout=10):' | |||||
33 |
|
33 | |||
34 |
|
34 | |||
35 | def write_file(path, content=b''): |
|
35 | def write_file(path, content=b''): | |
36 | with open(path, 'wb') as f: |
|
36 | if content: | |
|
37 | write_path = b'%s.tmp' % path | |||
|
38 | else: | |||
|
39 | write_path = path | |||
|
40 | with open(write_path, 'wb') as f: | |||
37 | f.write(content) |
|
41 | f.write(content) | |
|
42 | if path != write_path: | |||
|
43 | os.rename(write_path, path) |
General Comments 0
You need to be logged in to leave comments.
Login now