File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55import re
66import shlex
77import ipaddress
8+ from uuid import uuid4
89
910import attr
1011from pexpect import TIMEOUT
@@ -372,10 +373,16 @@ def _target_cleanup(tmpfile):
372373 stream = io .BytesIO (buf )
373374
374375 # We first write to a temp file, which we'll `dd` onto the destination file later
375- tmpfile = self ._run_check ('mktemp' )
376+ try :
377+ tmpfile = self ._run_check ('mktemp' )
378+ tmpfile = tmpfile [0 ]
379+ except ExecutionError :
380+ self .logger .info ("Unable to execute 'mktemp', falling back to create temporary file with touch" )
381+ tmpfile = f'/tmp/tmp-{ uuid4 ()} '
382+ self ._run_check (f'touch { tmpfile } ' )
383+
376384 if not tmpfile :
377385 raise ExecutionError ('Could not make temporary file on target' )
378- tmpfile = tmpfile [0 ]
379386
380387 try :
381388 rx_cmd = self ._get_xmodem_rx_cmd (tmpfile )
You can’t perform that action at this time.
0 commit comments