Skip to content

Commit 9d41d5b

Browse files
authored
Merge pull request #7 from ledunguit/main
Fix: Script execution detection failing on macOS/zsh
2 parents d6e06dd + 0064537 commit 9d41d5b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

phpvm.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,13 @@ phpvm_should_execute_main() {
931931
# Layer 2: Test mode
932932
[ "$PHPVM_TEST_MODE" = "true" ] && return 1
933933

934-
# Layer 3: Return test (most reliable POSIX method)
934+
# Layer 3: Check if script has arguments (most reliable indicator)
935+
# If script is called with arguments, it's likely being executed
936+
if [ $# -gt 0 ]; then
937+
return 0 # Execute
938+
fi
939+
940+
# Layer 4: Return test (fallback for POSIX shells)
935941
if (return 0 2>/dev/null); then
936942
return 1 # Sourced
937943
else

0 commit comments

Comments
 (0)