@Chawandi Prabhu Firstly, apologies for the delay in responding on this and any inconvenience this issue may have caused.
I believe that each command should be in its own string, e.g
commands = ["caddy", "reverse-proxy", etc]
Can you check and confirm if it is working for you or not?
Please 'Accept as answer' if it helped, so that it can help others in the community looking for help on similar topics