Skip to content

A platform for community discussion. Free, open, simple.

DEV: Make notify_file_change fallback to `nc` when `socat` missing (#10903)

David Taylor46d1c91e1a0f
diff --git a/bin/notify_file_change b/bin/notify_file_change
index e408e6e4088..8680b97966f 100755
--- a/bin/notify_file_change
+++ b/bin/notify_file_change
@@ -6,7 +6,11 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd ../tmp && pwd )"
SOCKET="$DIR"/file_change.sock
if [[ -e "$SOCKET" ]]; then
- echo "$1 $2" | socat - UNIX-CONNECT:$SOCKET >/dev/null 2>/dev/null
+ if command -v socat; then
+ echo "$1 $2" | socat - UNIX-CONNECT:$SOCKET >/dev/null 2>/dev/null
+ else
+ echo "$1 $2" | nc -U $SOCKET >/dev/null 2>/dev/null
+ fi
if [ $? != 0 ]; then
rm $SOCKET
fi