Fix escaping when launching in terminal with AppleScript. The invocation we're building up is wrapped in single quotes when passed to bash and wrapped in double quotes for AppleScript.
Here's an example invocation with the new escaping:
tell application "Terminal" activate do script "/bin/bash -c 'arch -arch arm64 '/Users/jonas/llvm/build-ra/bin/darwin-debug' --unix-socket=/tmp/dL2jSh --arch=arm64 --working-dir \"/private/tmp/with spaces\" --disable-aslr --env=\"OS_ACTIVITY_DT_MODE=enable\" -- \"/Users/jonas/llvm/build-ra/bin/lldb-instr\" \"foo bar\" \"baz quux\" ; echo Process exited with status $?';exit" end tell
Previously we were using unescaped single quotes which resulted in the whole bash invocation being passed in pieces. That works most of the time but breaks when you have a space in your current working directory for example.
rdar://91870763
Should we use raw C++ string literals for this?
https://en.cppreference.com/w/cpp/language/string_literal