fix dump problem (#35673)
if dump file existed it was not truncating the file, resulting in a file with unaltered filesize, with the new content at the beginning, "padded" with the tail of the old content, since the new content was not enough to overwrite it.
This commit is contained in:
parent
9c1c5c2936
commit
b32105f4da
@ -141,7 +141,7 @@ def dump_environment(path, environment=None):
|
||||
use_env = environment or os.environ
|
||||
hidden_vars = set(["PS1", "PWD", "OLDPWD", "TERM_SESSION_ID"])
|
||||
|
||||
fd = os.open(path, os.O_WRONLY | os.O_CREAT, 0o600)
|
||||
fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600)
|
||||
with os.fdopen(fd, "w") as env_file:
|
||||
for var, val in sorted(use_env.items()):
|
||||
env_file.write(
|
||||
|
Loading…
Reference in New Issue
Block a user