summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-10-05 13:48:52 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-10-05 13:49:23 (EDT)
commit7817ebf3c7cd10c4db1c907ff334bf678ee53232 (patch)
tree1eb6d72b97ad3cf35673de3bdc309e32fb87d493 /lib
parent330c70e06f98665f17bf23dbfb6988c6367ded7b (diff)
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
Diffstat (limited to 'lib')
-rw-r--r--lib/cmd/shell.sh4
1 files changed, 2 insertions, 2 deletions
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
}