Yin-Yang icon indicating copy to clipboard operation
Yin-Yang copied to clipboard

Custom command execution broken

Open Kayzels opened this issue 9 months ago • 2 comments

What happened?

Whenever trying to execute a custom script, it doesn't run. Running from the terminal says that

TypeError: check_call() got an unexpected keyword argument 'shell'

This seems to be calling helpers.check_call, which is supposed to be a wrapper for subprocess.check_call. The problem is that arguments aren't being forwarded to the inner function. This is very easily fixed by adding **kwargs to the inner function call, and to the function definition. I'd do a pull request, but I cannot get poetry working, so I can't properly test it.

Version

4.0.1

How did you install Yin & Yang?

AUR

What desktop environments are you seeing the problem on?

KDE

Which plugin causes the issue?

Custom Script

What software version do you use?

n/a

Relevant log output

Exception in thread Custom:
Traceback (most recent call last):
  File "/usr/lib/python3.13/threading.py", line 1041, in _bootstrap_inner
    self.run()
    ~~~~~~~~^^
  File "/usr/lib/python3.13/threading.py", line 992, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/yin_yang/yin_yang/plugins/_plugin.py", line 56, in set_mode
    self.set_theme(theme)
    ~~~~~~~~~~~~~~^^^^^^^
  File "/opt/yin_yang/yin_yang/plugins/custom.py", line 35, in set_theme
    helpers.check_call(command, shell=True)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
TypeError: check_call() got an unexpected keyword argument 'shell'
Successfully applied the color scheme Sweet to your current Plasma session
Exception in thread Custom:
Traceback (most recent call last):
  File "/usr/lib/python3.13/threading.py", line 1041, in _bootstrap_inner
    self.run()
    ~~~~~~~~^^
  File "/usr/lib/python3.13/threading.py", line 992, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/yin_yang/yin_yang/plugins/_plugin.py", line 56, in set_mode
    self.set_theme(theme)
    ~~~~~~~~~~~~~~^^^^^^^
  File "/opt/yin_yang/yin_yang/plugins/custom.py", line 35, in set_theme
    helpers.check_call(command, shell=True)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
TypeError: check_call() got an unexpected keyword argument 'shell'
Successfully applied the color scheme BreezeLight to your current Plasma session

Kayzels avatar May 14 '25 13:05 Kayzels

i removed the 'shell=True' from helpers.check_call(command, shell=True) in /opt/yin_yang/yin_yang/plugins/custom.py , for me this works fine (because i invoke a shellscript and not a command that needs to be run within a shell)

Dieterbe avatar May 20 '25 05:05 Dieterbe

i removed the 'shell=True' from helpers.check_call(command, shell=True) in /opt/yin_yang/yin_yang/plugins/custom.py , for me this works fine (because i invoke a shellscript and not a command that needs to be run within a shell)

As far as I understand it, that's required if you have spaces in the command. I have a script that takes in a single argument (light or dark) and does the changes based on that. So if I were to remove the shell=True there might be issues. So it's better to just pass it in as an argument to subprocess.

Kayzels avatar May 20 '25 15:05 Kayzels