From 7817ebf3c7cd10c4db1c907ff334bf678ee53232 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sun, 05 Oct 2014 13:48:52 -0400 Subject: cmd/shell: Use session_exec() Now command arguments are separated and escaped naturally. For example, the following commands work: $ sudo prokit shell $root printf 'arg: %s\n' foo bar arg: foo arg: bar $ sudo prokit shell $root printf 'arg: %s\n' 'foo bar' arg: foo bar $ sudo prokit shell $root printf "'ello world\n" 'ello world --- (limited to 'lib') diff --git a/lib/cmd/shell.sh b/lib/cmd/shell.sh index c2570e0..c6e0906 100644 --- a/lib/cmd/shell.sh +++ b/lib/cmd/shell.sh @@ -40,11 +40,11 @@ cmd_shell_main() session_begin "${root}" . : session_dir="/prokit/sessions/$(session_id)" if [ ${#} -eq 0 ]; then - chroot "${root}" /bin/sh -c "cd '${session_dir}'; /bin/sh" + session_exec /bin/sh printf '\n' info "$(get_msg 'cmd_shell_exiting')" else - chroot "${root}" /bin/sh -c "cd '${session_dir}'; ${*}" + session_exec "${@}" fi session_end } -- cgit v0.9.1