Skip to content

Adds quotes to command parameters with runInBash set to false #426

Open
@fenhl

Description

Describe the bug
When running a command from a plugin that has <swiftbar.runInBash>false</swiftbar.runInBash> configured, and the command has a parameter with a space in it, the command receives that parameter surrounded with single quotes.

To Reproduce
Steps to reproduce the behavior:

  1. Copy the command.py file below to ~/Desktop/swiftbar-escape/command.py
  2. Add the test.10s.py file below to your plugin folder, adjusting the username in the path on line 6.
  3. Wait until the “Python Test” plugin appears
  4. Python Test › Run Command
  5. Check ~/Dekstop/swiftbar-escape/python-command.log, it will say ['/Users/<your username>/Desktop/swiftbar-escape/command.py', "'foo bar'"]

Expected behavior
python-command.log should say ['/Users/<your username>/Desktop/swiftbar-escape/command.py', 'foo bar'], without the extra quotes

Environment:

  • macOS version: Sequoia 15.0.1
  • SwiftBar version: 2.0.0 (520)

Plugin Example:

test.10s.py:

#!/usr/bin/env python3
# <swiftbar.runInBash>false</swiftbar.runInBash>

print('Python Test')
print('---')
print('Run Command | bash=/Users/fenhl/Desktop/swiftbar-escape/command.py param1="foo bar" terminal=false')

command.py:

#!/usr/bin/env python3

import sys

import pathlib

with (pathlib.Path.home() / 'Desktop/swiftbar-escape/python-command.log').open('w') as f:
    print(sys.argv, file=f)

Additional Context:

  • I don't run Bartender/Dozer/etc. or tested the issue without it running

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions