Describe the bug
Removal of the temporary file fails in the case where the sudo is required for the chdir to succeed/
To Reproduce
Any file.put with:
_chdir is not None`
_sudo=True and
- the
sudo is required for the `chdir to succeed
Expected behavior
The full operation should succeed.
Meta
System: Darwin
Platform: macOS-14.7.7-arm64-arm-64bit
Release: 23.6.0
Machine: arm64
pyinfra: v3.4.1
click: v8.2.1
click: v8.2.1
click: v8.2.1
distro: v1.9.0
gevent: v25.5.1
jinja2: v3.1.6
packaging: v25.0
paramiko: v3.5.1
python-dateutil: v2.9.0.post0
pywinrm: v0.5.0
typeguard: v4.4.4
typing-extensions: v4.14.1
Executable: /Users/someone/.local/bin/pyinfra
Python: 3.12.11 (CPython, Clang 20.1.4 )