You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: registry/coder/modules/cmux/run.sh
+19-1Lines changed: 19 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -90,10 +90,28 @@ if [ ! -f "$CMUX_BINARY" ] || [ "${USE_CACHED}" != true ]; then
90
90
exit 1
91
91
fi
92
92
CANDIDATE=""
93
+
# Common locations
93
94
if [ -f"$TMP_DIR/package/bin/cmux" ];then
94
95
CANDIDATE="$TMP_DIR/package/bin/cmux"
96
+
elif [ -f"$TMP_DIR/package/bin/cmux.js" ];then
97
+
CANDIDATE="$TMP_DIR/package/bin/cmux.js"
98
+
elif [ -f"$TMP_DIR/package/bin/cmux.mjs" ];then
99
+
CANDIDATE="$TMP_DIR/package/bin/cmux.mjs"
95
100
else
96
-
CANDIDATE="$(find "$TMP_DIR/package" -maxdepth 3 -type f -name "cmux"| head -n1)"
101
+
# Try to read package.json bin field
102
+
if [ -f"$TMP_DIR/package/package.json" ];then
103
+
BIN_PATH=$(sed -n 's/.*"bin"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p'"$TMP_DIR/package/package.json"| head -n1)
104
+
if [ -z"$BIN_PATH" ];then
105
+
BIN_PATH=$(sed -n '/"bin"[[:space:]]*:[[:space:]]*{/,/}/p'"$TMP_DIR/package/package.json"| sed -n 's/.*"cmux"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p'| head -n1)
106
+
fi
107
+
if [ -n"$BIN_PATH" ] && [ -f"$TMP_DIR/package/$BIN_PATH" ];then
108
+
CANDIDATE="$TMP_DIR/package/$BIN_PATH"
109
+
fi
110
+
fi
111
+
# Fallback: search for plausible filenames
112
+
if [ -z"$CANDIDATE" ] || [ !-f"$CANDIDATE" ];then
113
+
CANDIDATE=$(find "$TMP_DIR/package" -maxdepth 4 -type f \( -name "cmux" -o -name "cmux.js" -o -name "cmux.mjs" -o -name "cmux.cjs"\)| head -n1)
0 commit comments