Files
paseo/packages/desktop/bin/paseo
yz efd7ab3420 Fix macOS packaged CLI daemon Dock icons (#1759)
* Fix macOS CLI daemon relaunch path

* test(cli): mock helper existence in daemon launch test

* fix(desktop): launch packaged CLI through Helper

The packaged macOS CLI shim entered through the main app executable, so daemon supervision inherited app lifecycle behavior and surfaced Dock icons. Make Helper the required macOS CLI runtime, keep daemon relaunches on process.execPath, and cover cold bundled CLI daemon starts in release smoke.

---------

Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
2026-06-29 20:45:53 +02:00

48 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
set -eu
SCRIPT_PATH=$0
case "$SCRIPT_PATH" in
/*) ;;
*) SCRIPT_PATH="$(pwd)/$SCRIPT_PATH" ;;
esac
# Follow symlinks so `/usr/local/bin/paseo` resolves back into the app bundle.
while [ -L "$SCRIPT_PATH" ]; do
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$SCRIPT_PATH")" && pwd)
LINK_TARGET=$(readlink "$SCRIPT_PATH")
case "$LINK_TARGET" in
/*) SCRIPT_PATH="$LINK_TARGET" ;;
*) SCRIPT_PATH="${SCRIPT_DIR}/${LINK_TARGET}" ;;
esac
done
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$SCRIPT_PATH")" && pwd)
RESOURCES_DIR=$(CDPATH= cd -- "${SCRIPT_DIR}/.." && pwd)
MACOS_DIR="${RESOURCES_DIR}/../MacOS"
MACOS_HELPER_EXECUTABLE="${RESOURCES_DIR}/../Frameworks/Paseo Helper.app/Contents/MacOS/Paseo Helper"
# macOS CLI invocations must enter Electron through the agent Helper. Launching
# the main APPL executable here makes later daemon supervision inherit app UI
# lifecycle behavior.
if [ -d "${MACOS_DIR}" ]; then
if [ ! -x "${MACOS_HELPER_EXECUTABLE}" ]; then
echo "Bundled Paseo Helper executable not found at ${MACOS_HELPER_EXECUTABLE}" >&2
exit 1
fi
APP_EXECUTABLE="${MACOS_HELPER_EXECUTABLE}"
elif [ -x "${RESOURCES_DIR}/../Paseo.bin" ]; then
APP_EXECUTABLE="${RESOURCES_DIR}/../Paseo.bin"
elif [ -x "${RESOURCES_DIR}/../Paseo" ]; then
APP_EXECUTABLE="${RESOURCES_DIR}/../Paseo"
else
echo "Bundled Paseo executable not found relative to ${RESOURCES_DIR}" >&2
exit 1
fi
RUNNER_PATH="${RESOURCES_DIR}/app.asar.unpacked/dist/daemon/node-entrypoint-runner.js"
CLI_ENTRYPOINT="${RESOURCES_DIR}/app.asar/node_modules/@getpaseo/cli/dist/index.js"
exec env ELECTRON_RUN_AS_NODE=1 PASEO_NODE_ENV=production "${APP_EXECUTABLE}" --disable-warning=DEP0040 "${RUNNER_PATH}" node-script "${CLI_ENTRYPOINT}" "$@"