Services running as root should survive restarts just as well as ones
running as other users. But I think start-stop-daemon will get this
wrong.
. tests/lib
-coproc userv --override 'execute cat -vet' games spong
+for service_user in games root; do
+ coproc userv --override 'execute cat -vet' "$service_user" spong
-stdout=${COPROC[0]}
-stdin=${COPROC[1]}
+ stdout=${COPROC[0]}
+ stdin=${COPROC[1]}
-print_expect_reply () {
- local m=$1
- local got
- echo >&$stdin "$m"
- read <&$stdout got
- local exp="$(printf '%s$\n' "$m")"
- test "$got" = "$exp"
-}
+ print_expect_reply () {
+ local m=$1
+ local got
+ echo >&$stdin "$m"
+ read <&$stdout got
+ local exp="$(printf '%s$\n' "$m")"
+ test "$got" = "$exp"
+ }
-print_expect_reply hi
+ print_expect_reply hi
-service userv restart
+ service userv restart
-print_expect_reply ho
+ print_expect_reply ho
+done
echo ok.