mc-send-to-console skips user change when non-root (#1419)

Fixes #1393
This commit is contained in:
Geoff Bourne 2022-03-11 14:34:10 -06:00 committed by GitHub
parent 65d6c5bb32
commit 676b0f88cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,4 +12,8 @@ if [ ! -p "${CONSOLE_IN_NAMED_PIPE}" ]; then
exit 1
fi
gosu minecraft bash -c "echo $* > '${CONSOLE_IN_NAMED_PIPE:-/tmp/minecraft-console-in}'"
if [ "$(id -u)" = 0 ]; then
gosu minecraft bash -c "echo $* > '${CONSOLE_IN_NAMED_PIPE:-/tmp/minecraft-console-in}'"
else
echo "$@" > "${CONSOLE_IN_NAMED_PIPE:-/tmp/minecraft-console-in}"
fi