fix(tproxy): detect clash process with any name (clash-linux-amd64, etc.)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Developer 2025-12-02 01:28:17 -08:00
parent b00cec6b3b
commit 7d257cd35f
1 changed files with 4 additions and 3 deletions

View File

@ -60,7 +60,8 @@ check_root() {
} }
check_clash() { check_clash() {
if ! pgrep -x "clash" > /dev/null 2>&1; then # Check for any clash process (clash, clash-linux-amd64, etc.)
if ! pgrep -f "clash" > /dev/null 2>&1; then
log_error "Clash is not running" log_error "Clash is not running"
log_info "Please start Clash first" log_info "Please start Clash first"
exit 1 exit 1
@ -192,9 +193,9 @@ show_status() {
# Check Clash # Check Clash
echo "Clash Process:" echo "Clash Process:"
if pgrep -x "clash" > /dev/null 2>&1; then if pgrep -f "clash" > /dev/null 2>&1; then
echo -e " Status: ${GREEN}Running${NC}" echo -e " Status: ${GREEN}Running${NC}"
echo " PID: $(pgrep -x clash)" echo " PID: $(pgrep -f clash | head -1)"
else else
echo -e " Status: ${RED}Not Running${NC}" echo -e " Status: ${RED}Not Running${NC}"
fi fi