Skip to content

Commit

Permalink
driver/usbstoragedriver: wrap commands
Browse files Browse the repository at this point in the history
Use the wrap_command() function to escape command arguments in case a remote
operation over SSH is done.

Fixes labgrid-project#1392
Alternative to labgrid-project#1450

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
  • Loading branch information
Emantor committed Oct 21, 2024
1 parent 5f0ae27 commit 343abb2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions labgrid/driver/usbstoragedriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def write_files(self, sources, target, partition, target_is_directory=True):

args = ["cp", "-T", copied_sources[0], target_path]

processwrapper.check_output(self.storage.command_prefix + args)
processwrapper.check_output(self.storage.wrap_command(args))
self.proxy.unmount(self.devpath)
except:
# We are going to die with an exception anyway, so no point in waiting
Expand Down Expand Up @@ -231,7 +231,7 @@ def get_size(self, partition=None):
"""
args = ["cat", f"/sys/class/block/{self._get_devpath(partition)[5:]}/size"]
try:
size = subprocess.check_output(self.storage.command_prefix + args)
size = subprocess.check_output(self.storage.wrap_command(args))
except subprocess.CalledProcessError:
# while the medium is getting ready, the file does not yet exist
return 0
Expand Down

0 comments on commit 343abb2

Please sign in to comment.