Windows version
Windows 11
Windows OS build
Any
YASB version installed
1.9.1 (and before)
Describe the bug
The custom widget interprets exec_cmd as a string that is split using .split(" "), then fed as a sequence in subprocess.popen in the CustomWorker class. This results in commands with spaces inside arguments to break. subprocess.popen supports being passed a string, which is documented as being platform-dependent. An alternative would be to add an additional flag to not split the command but pass it as is.
Example:
run_cmd: 'curl.exe -H "Authorization: Bearer MY_API_KEY" https://api.ipinfo.io/lite/8.8.8.8'
turns into:
['curl.exe', '-H', '"Authorization:', 'Bearer', 'MY_API_KEY"', 'https://api.ipinfo.io/lite/8.8.8.8']
which breaks the -H parameter.
Line 75 of core.widgets.yasb.custom:
self._exec_cmd = self.config.exec_options.run_cmd.split(" ") if self.config.exec_options.run_cmd else None
Could either become:
self._exec_cmd = self.config.exec_options.run_cmd if self.config.exec_options.run_cmd else None
Or core.validation.widgets.yasb.custom.ExecOptionsConfig could be modified to have a run_raw: bool = False that, when true, would skip the split command. Something as simple as:
if self.config.exec_options.run_raw:
self._exec_cmd = self.config.exec_options.run_cmd if self.config.exec_options.run_cmd else None
else:
self._exec_cmd = self.config.exec_options.run_cmd.split(" ") if self.config.exec_options.run_cmd else None
Relevant log output
Windows version
Windows 11
Windows OS build
Any
YASB version installed
1.9.1 (and before)
Describe the bug
The custom widget interprets exec_cmd as a string that is split using .split(" "), then fed as a sequence in subprocess.popen in the CustomWorker class. This results in commands with spaces inside arguments to break. subprocess.popen supports being passed a string, which is documented as being platform-dependent. An alternative would be to add an additional flag to not split the command but pass it as is.
Example:
run_cmd: 'curl.exe -H "Authorization: Bearer MY_API_KEY" https://api.ipinfo.io/lite/8.8.8.8'turns into:
['curl.exe', '-H', '"Authorization:', 'Bearer', 'MY_API_KEY"', 'https://api.ipinfo.io/lite/8.8.8.8']which breaks the -H parameter.
Line 75 of core.widgets.yasb.custom:
Could either become:
Or core.validation.widgets.yasb.custom.ExecOptionsConfig could be modified to have a
run_raw: bool = Falsethat, when true, would skip the split command. Something as simple as:Relevant log output