Skip to content

Commit 1730f69

Browse files
douglas-raillard-armmarcbonnici
authored andcommitted
target: Avoid intermittent error when installing binary
Installing busybox sometimes fails with: cp: /data/local/tmp/bin/busybox: Text file busy This happens when trying to modify a binary file while a process is still running (e.g. unclean previous disconnection). Fix that by using the -f option, which will remove the destination file first and retry the copy in case of failure.
1 parent cf4d3b5 commit 1730f69

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

devlib/target.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2134,7 +2134,7 @@ async def install_executable(self, filepath, with_name=None, timeout=None):
21342134
on_device_executable = self.path.join(self.executables_directory, executable_name)
21352135
await self.push.asyn(filepath, on_device_file, timeout=timeout)
21362136
if on_device_file != on_device_executable:
2137-
await self.execute.asyn('cp {} {}'.format(quote(on_device_file), quote(on_device_executable)),
2137+
await self.execute.asyn('cp -f -- {} {}'.format(quote(on_device_file), quote(on_device_executable)),
21382138
as_root=self.needs_su, timeout=timeout)
21392139
await self.remove.asyn(on_device_file, as_root=self.needs_su)
21402140
await self.execute.asyn("chmod 0777 {}".format(quote(on_device_executable)), as_root=self.needs_su)

0 commit comments

Comments
 (0)