Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def off(self):
cmd = shlex.split(self.cmd_off)
processwrapper.check_output(cmd)
managed_configs.append(mconfig)
cmd = self.interface.command_prefix+[self.tool]
cmd += chain.from_iterable(("--search", path) for path in self.search)
for mconfig in managed_configs:
cmd.append("--file")
cmd.append(mconfig.get_remote_path())
cmd += self._get_usb_path_cmd()
cmd += [
"--command", "'init'",
"--command", "'bootstrap {}'".format(mf.get_remote_path()),
"--command", "'shutdown'",
]
processwrapper.check_output(cmd)
"seek={}".format(seek),
"conv=fdatasync"
]
elif mode == Mode.BMAPTOOL:
if skip or seek:
raise ExecutionError("bmaptool does not support skip or seek")
args = [
"bmaptool",
"copy",
"{}".format(mf.get_remote_path()),
"{}{}".format(self.storage.path, partition),
]
else:
raise ValueError
processwrapper.check_output(
self.storage.command_prefix + args
)
def off(self):
processwrapper.check_output(
self._get_sigrok_prefix() + ["--config", "enabled=no", "--set"]
)
def load(self, filename=None):
if self.target.env:
usb_loader = self.target.env.config.get_image_path(self.usb_loader)
mf = ManagedFile(usb_loader, self.loader)
mf.sync_to_resource()
timeout = Timeout(3.0)
while True:
try:
processwrapper.check_output(
self.loader.command_prefix +
[self.tool, 'db', mf.get_remote_path()]
)
break
except subprocess.CalledProcessError:
if timeout.expired:
raise
if filename is None and self.image is not None:
filename = self.target.env.config.get_image_path(self.image)
mf = ManagedFile(filename, self.loader)
mf.sync_to_resource()
timeout = Timeout(3.0)
while True:
try: