mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 08:10:44 +00:00
test: launch macos parallels gateway in guest
This commit is contained in:
@@ -1276,23 +1276,42 @@ start_manual_gateway_if_needed() {
|
||||
if ! headless_guest_fallback; then
|
||||
return 0
|
||||
fi
|
||||
local gateway_log guest_home
|
||||
local gateway_log guest_gateway_log guest_home launch_cmd
|
||||
guest_home="$(parallels_macos_resolve_desktop_home "$VM_NAME" "$GUEST_CURRENT_USER")"
|
||||
gateway_log="$RUN_DIR/macos-gateway-prlctl.log"
|
||||
guest_gateway_log="/tmp/openclaw-parallels-macos-gateway.log"
|
||||
guest_current_user_exec /usr/bin/pkill -f 'openclaw.*gateway run' >/dev/null 2>&1 || true
|
||||
guest_current_user_exec /usr/bin/pkill -f 'openclaw-gateway' >/dev/null 2>&1 || true
|
||||
guest_current_user_exec /usr/bin/pkill -f 'openclaw.mjs gateway' >/dev/null 2>&1 || true
|
||||
/usr/bin/nohup prlctl exec "$VM_NAME" /usr/bin/sudo -H -u "$GUEST_CURRENT_USER" /usr/bin/env \
|
||||
"HOME=$guest_home" \
|
||||
"USER=$GUEST_CURRENT_USER" \
|
||||
"LOGNAME=$GUEST_CURRENT_USER" \
|
||||
"PATH=$GUEST_EXEC_PATH" \
|
||||
"$API_KEY_ENV=$API_KEY_VALUE" \
|
||||
"OPENCLAW_HOME=$guest_home" \
|
||||
"OPENCLAW_STATE_DIR=$guest_home/.openclaw" \
|
||||
"OPENCLAW_CONFIG_PATH=$guest_home/.openclaw/openclaw.json" \
|
||||
"$GUEST_NODE_BIN" "$GUEST_OPENCLAW_ENTRY" gateway run --bind loopback --port 18789 --force \
|
||||
>"$gateway_log" 2>&1 &
|
||||
launch_cmd="$(cat <<EOF
|
||||
set -euo pipefail
|
||||
trap '' HUP
|
||||
/usr/bin/env \\
|
||||
HOME=$(shell_quote "$guest_home") \\
|
||||
USER=$(shell_quote "$GUEST_CURRENT_USER") \\
|
||||
LOGNAME=$(shell_quote "$GUEST_CURRENT_USER") \\
|
||||
PATH=$(shell_quote "$GUEST_EXEC_PATH") \\
|
||||
$(shell_quote "$API_KEY_ENV=$API_KEY_VALUE") \\
|
||||
OPENCLAW_HOME=$(shell_quote "$guest_home") \\
|
||||
OPENCLAW_STATE_DIR=$(shell_quote "$guest_home/.openclaw") \\
|
||||
OPENCLAW_CONFIG_PATH=$(shell_quote "$guest_home/.openclaw/openclaw.json") \\
|
||||
$(shell_quote "$GUEST_NODE_BIN") $(shell_quote "$GUEST_OPENCLAW_ENTRY") gateway run --bind loopback --port 18789 --force \\
|
||||
< /dev/null >$(shell_quote "$guest_gateway_log") 2>&1 &
|
||||
gateway_pid="\$!"
|
||||
printf 'guest gateway pid %s\n' "\$gateway_pid"
|
||||
printf 'guest gateway log %s\n' $(shell_quote "$guest_gateway_log")
|
||||
sleep 1
|
||||
if ! kill -0 "\$gateway_pid" >/dev/null 2>&1; then
|
||||
tail -n 120 $(shell_quote "$guest_gateway_log") >&2 || true
|
||||
exit 1
|
||||
fi
|
||||
EOF
|
||||
)"
|
||||
if ! guest_current_user_sh "$launch_cmd" >"$gateway_log" 2>&1; then
|
||||
cat "$gateway_log" >&2 || true
|
||||
return 1
|
||||
fi
|
||||
cat "$gateway_log"
|
||||
}
|
||||
|
||||
verify_gateway() {
|
||||
|
||||
Reference in New Issue
Block a user