We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3606e4f commit 1431ba6Copy full SHA for 1431ba6
save_command_strategies/linux_procfs.sh
@@ -13,7 +13,10 @@ exit_safely_if_empty_ppid() {
13
14
full_command() {
15
[[ -z "$COMMAND_PID" ]] && exit 0
16
- cat /proc/${COMMAND_PID}/cmdline | xargs -0 printf "%q "
+ # See: https://unix.stackexchange.com/a/567021
17
+ # Avoid complications with system printf by using bash subshell interpolation.
18
+ # This will properly escape sequences and null in cmdline.
19
+ cat /proc/${COMMAND_PID}/cmdline | xargs -0 bash -c 'printf "%q " "$0" "$@"'
20
}
21
22
main() {
0 commit comments