max-mapper / monu

menubar process monitor mac app [ALPHA]
https://github.com/maxogden/monu/releases
BSD 2-Clause "Simplified" License
1.11k stars 74 forks source link

escape quotes in commands #35

Open max-mapper opened 8 years ago

max-mapper commented 8 years ago

If you add to your config e.g. bash -c "echo foo", it gets turned into mon "bash -c "echo foo"" which means the inner quotes essentially get ignored and the running process will look like mon bash -c echo foo, when it should look like mon bash -c "echo foo".

The fix is to escape the inner quotes, the user can do this manually but I think we should probably do this for them. I wonder if it is as simple as simply replacing " with \"?

marcbachmann commented 8 years ago

Isn't that invalid json if a user doesn't escape it?

Keep in mind that you shouldn't replace already escaped quotes \".

max-mapper commented 8 years ago

well in my config its actually:

    "gititude-update": "run-every 600 bash -c \\\"gititude update || true\\\""

:D