I wrote a short Raku script that connects to my VPN provider using a command piactl. In my first version I used an approach similar to one I've used many times before, calling out to a shell and being very careful about shell escaping issues:
run 'bash', '-c', 'piactl disconnect && piactl set region "$1" && piactl connect', '--', $region; I happened to browse the Raku docs about quoting constructs, and something finally clicked about quote protection within « » quotes. It works like a shell! run «bash -c 'piactl disconnect && piactl set region "$1" && piactl connect' -- "$region"»; It's just as safe as the first version, but a bit more readable. At this point I realized that I really didn't need the shell after all. run in sink context raises an error, so I could just as well do that at every step as for the overall chain of calls: run <piactl disconnect>; run «piactl set region "$region"»; run <piactl connect>; And the quote protection I was so happy to have figured out is slightly less readable than the plain vanilla alternative: run <piactl set region>, $region; I'm glad it's there in case I need it in the future, though. I'd use it if there were additional arguments, eg: run «piactl set region "$region" --force»;
