From 676b0f88cf071476abc40dbac3b61ca81cd0ca23 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Fri, 11 Mar 2022 14:34:10 -0600 Subject: [PATCH] mc-send-to-console skips user change when non-root (#1419) Fixes #1393 --- bin/mc-send-to-console | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/mc-send-to-console b/bin/mc-send-to-console index 7615c241..91ae0b65 100755 --- a/bin/mc-send-to-console +++ b/bin/mc-send-to-console @@ -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}'" \ No newline at end of file +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 \ No newline at end of file