Compare commits

...

2 Commits

Author SHA1 Message Date
Bruno Sutic 75458f91c8
Merge pull request #450 from mdeguzis/master
Use bash subshell for procfs interpolation of cmdline file
2022-08-17 09:09:56 +02:00
Michael T. DeGuzis 1431ba6fbe Use bash subshell for procfs interpolation of cmdline file 2022-08-16 08:57:39 -04:00
1 changed files with 4 additions and 1 deletions

View File

@ -13,7 +13,10 @@ exit_safely_if_empty_ppid() {
full_command() {
[[ -z "$COMMAND_PID" ]] && exit 0
cat /proc/${COMMAND_PID}/cmdline | xargs -0 printf "%q "
# See: https://unix.stackexchange.com/a/567021
# Avoid complications with system printf by using bash subshell interpolation.
# This will properly escape sequences and null in cmdline.
cat /proc/${COMMAND_PID}/cmdline | xargs -0 bash -c 'printf "%q " "$0" "$@"'
}
main() {