Skip to content

Conversation

@ronaldtse
Copy link
Contributor

This PR adds a SystemCommand module to centralize cross-platform command execution concerns.

Changes

  • Create SystemCommand module with three main utilities:

    • format_path: Format paths for command execution (Windows backslash conversion + quoting)
    • headless_environment: Get env vars for headless operation (disable DISPLAY on Unix)
    • find_executable: Find executables in PATH with PATHEXT handling
  • Refactor InkscapeWrapper to use:

    • SystemCommand.format_path instead of external_path
    • SystemCommand.headless_environment instead of headless_environment
    • SystemCommand.find_executable instead of manual executable search
  • Refactor GhostscriptWrapper to use:

    • SystemCommand.find_executable instead of find_in_path
  • Remove duplicated methods from wrappers:

    • external_path (was in InkscapeWrapper)
    • headless_environment (was in InkscapeWrapper)
    • find_in_path (was in GhostscriptWrapper)

Benefits

  • Single namespace for cross-platform command execution utilities
  • Cleaner wrappers - focused on tool-specific logic, not platform quirks
  • DRY - eliminates duplicated path formatting and executable discovery code
  • Clear separation - Platform for OS detection, SystemCommand for command execution

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.

1 participant