SIGN IN SIGN UP
1Panel-dev / 1Panel UNCLAIMED

🔥 Take full control of your VPS with 1Panel. Deploy OpenClaw in one click.

0 0 148 Go

fix(cmd): use exec.LookPath in Which() so detection works without external 'which' (#12651)

cmd.Which() previously shelled out to `which <name>` to determine whether
a binary was on PATH. On distributions that do not ship a `which` package
by default — Arch Linux is the canonical example, but the same applies to
several minimal container images — `which` itself is missing, so every
call to Which() returned false and 1Panel reported core dependencies
(notably Docker) as 'not installed' even when they were running normally.

Switch the primary path to Go's exec.LookPath, which uses the process
PATH directly and has no external dependency. The original shell-out is
preserved as a fallback so any environment where the agent's PATH
differs from the user's interactive shell PATH (the original reason the
shell-out existed) keeps working unchanged.

Both copies are updated (agent/utils/cmd/cmd.go and core/utils/cmd/cmd.go)
and a small unit test is added to each package to guard the regression.

Fixes #12605

Signed-off-by: Sanjay Santhanam <51058514+Sanjays2402@users.noreply.github.com>
S
Sanjay Santhanam committed
b06bc0a4554f9e9bf816b0f9a2ecac3b857bcaec
Parent: 68411bd
Committed by GitHub <noreply@github.com> on 5/6/2026, 2:47:02 AM