Skip to content

Conversation

@kundeng
Copy link

@kundeng kundeng commented Aug 11, 2025

Summary

  • Fixes grep portability issue in extract_tunnel_url() function
  • Adds OS detection to use appropriate grep syntax for macOS vs Linux
  • Uses basic regex (-oE) for macOS/Darwin instead of Perl regex (-oP)
  • Maintains compatibility across GNU and BSD grep implementations

Problem

The extract_tunnel_url() function was using Perl regex syntax (-oP) which is not available in macOS's default grep implementation, causing tunnel URL extraction to fail on macOS systems.

Solution

Added conditional logic to detect the operating system and use the appropriate grep syntax:

  • macOS/Darwin: Uses basic extended regex (-oE) with a simpler pattern
  • Linux: Continues using Perl regex (-oP) with lookbehind/lookahead

Test plan

  • Verified the fix works correctly on macOS (Darwin)
  • Confirmed backward compatibility with existing Linux grep syntax
  • Tested tunnel URL extraction with sample cloudflare URLs

🤖 Generated with Claude Code

bayeslearnerold and others added 2 commits August 8, 2025 22:50
Use temp file approach instead of in-place editing to avoid
compatibility issues between GNU sed (-i without space) and
BSD sed (-i with space for backup extension).

This ensures harbor.sh works correctly regardless of which
sed implementation is installed (common issue on macOS with
Homebrew's GNU sed).
- Add OS detection to use appropriate grep syntax
- Use basic regex (-oE) for macOS/Darwin instead of Perl regex (-oP)
- Maintains compatibility across GNU and BSD grep implementations
- Fixes tunnel URL extraction on macOS systems

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

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants