Commit Graph

6 Commits

Author SHA1 Message Date
Chris Tate 8252927d7e Fix zombie process orphaning on CLI crash (#255)
Spawn child processes with detached:true on Unix so they get their own
process group. Signal handlers now kill the entire group via
process.kill(-pid) instead of just the immediate child, preventing
orphaned dev servers from surviving CLI crashes or kill -9.

Add `portless prune` command as a safety net to find and kill orphaned
dev servers left behind by dead CLI sessions. It reads stale route
entries, checks if something is still listening on each port, and
terminates the orphan.

Add e2e tests covering both the SIGKILL cleanup path and the prune
command.
2026-04-28 01:07:09 -05:00
Chris Tate 203a3e0cf5 Fix lock contention when running parallel commands (#174) (#230)
* Fix lock contention when running parallel commands (#174)

Replace the fixed-delay retry strategy (20 retries * 50ms = 1s budget)
with exponential backoff and jitter (10ms-500ms delays, 5s budget).
The old approach caused "Failed to acquire route lock" errors in
monorepos running many portless commands in parallel.

* Fix Windows CI: use file URL for ESM import in worker script

On Windows, path.resolve produces backslash-separated paths which
Node.js ESM does not accept in import specifiers. Convert to a
file:// URL with pathToFileURL so the worker script loads correctly
on all platforms.

Also reorder assertions so lock failures surface before the ENOENT
on routes.json.
2026-04-13 17:14:40 -05:00
Chris Tate fee2c47d17 Default to HTTPS on port 443, with auto-sudo and HTTP-to-HTTPS redirect (#172)
* portless

Fixes #123 and #145

* https

* redirect

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* tests

* fix tests

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes
2026-03-31 11:27:23 -05:00
Chris Tate 003090863a adds search (#143)
* adds search

* fix format

* og

* fix e2e tests
2026-03-19 02:29:21 -05:00
Chris Tate e0a6a9eb67 fix: add Windows compatibility for hosts file management (#113)
This PR adds Windows compatibility for hosts file management functionality in portless.

## Problem
The CLI was hardcoded to use Unix-style paths and commands for hosts file operations (`/etc/hosts`, `sudo`), making it incompatible with Windows systems.

## Changes
- Added Windows detection and proper hosts file path resolution (`C:\Windows\System32\drivers\etc\hosts`)
- Updated all CLI help text and error messages to use platform-appropriate file paths and commands
- Replaced hardcoded `/etc/hosts` references with dynamic `HOSTS_DISPLAY` variable
- Replaced `sudo` prefix with platform-aware `SUDO_PREFIX` (empty on Windows, "sudo " on Unix)
- Updated error messages to suggest "run as Administrator" on Windows vs "requires sudo" on Unix

## Implementation Details
- Added `isWindows` platform detection using `process.platform`
- Created display-friendly constants for consistent messaging across all commands
- Updated hosts file path resolution in `hosts.ts` to use `SystemRoot` environment variable with fallback

Fixes #112
2026-03-14 23:13:04 -05:00
Chris Tate 022eca2ed2 fix vite support and add e2e tests for 11 frameworks (#32)
* inject --port flag

* fix vite

* e2e tests

* more e2e tests

* fixes

* improvements
2026-02-22 09:08:17 -06:00