conf: handle array of arguments in context.exec

We handeled "arg1 arg2 ... " before and used to split between spaces to
get the arguments for execvp but that doesn't work so well when there
are arguments with spaces.

Instead use JSON parsing to get the array of arguments. This make it
possible to use [ arg1 arg2 .. ] and quote each arg separately. You
can still use the old method and even double escape:

"\"arg1\" \"arg2 with spaces\"" or
 [ "arg1" "arg2 with spaces" ]
This commit is contained in:
Wim Taymans 2024-04-26 17:06:14 +02:00
parent 4a19a76dc1
commit 7f4a0ba8cb
4 changed files with 51 additions and 18 deletions

View file

@ -413,7 +413,7 @@ part of the initialization of the PipeWire program.
```json
context.exec = [
#{ path = <program-name>
# ( args = "<arguments>" )
# ( args = "<arguments>" | [ <arg1> <arg2> ... ] )
# ( condition = [ { <key> = <value> ... } ... ] )
#}
]