Skip to content

Commit a044dbc

Browse files
aarondfrancisclaude
andcommitted
Address CodeRabbit review feedback
- Remove absolute path from CLAUDE.md documentation - Fix PTY discovery to support Linux /dev/pts/* pseudo-terminals - Dynamically detect controlling TTY instead of hardcoding /dev/ttys000 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent c82f0e1 commit a044dbc

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ composer install
3939
```
4040

4141
### Testing the Package
42-
Since this is a Laravel package (not an application), it uses Orchestra Testbench for testing. Tests are in `/Users/aaron/Code/soloterm/solo/tests/` with two suites:
42+
Since this is a Laravel package (not an application), it uses Orchestra Testbench for testing. Tests are in the `tests/` directory with two suites:
4343
- `tests/Unit/` - Unit tests for individual components
4444
- `tests/Integration/` - Integration tests for full features
4545

src/Commands/Concerns/ManagesProcess.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,18 +398,28 @@ public function sendSizeViaStty(): void
398398
*/
399399
protected function discoverPtyDevice(int $pid): ?string
400400
{
401+
// Detect current TTY to skip (the controlling terminal for this PHP process)
402+
$currentTty = null;
403+
if (function_exists('posix_ttyname')) {
404+
$currentTty = @posix_ttyname(STDIN);
405+
} elseif (PHP_OS_FAMILY !== 'Windows') {
406+
$tty = @shell_exec('tty 2>/dev/null');
407+
$currentTty = $tty ? trim($tty) : null;
408+
}
409+
401410
$output = [];
402411
exec(sprintf('lsof -p %d 2>/dev/null', $pid), $output);
403412

404413
foreach ($output as $line) {
405-
if (!preg_match('#(/dev/tty\S+|/dev/pty\S+)#', $line, $matches)) {
414+
// Match /dev/tty*, /dev/pty*, and /dev/pts/* (Linux pseudo-terminals)
415+
if (!preg_match('#(/dev/(tty\S+|pty\S+|pts/\d+))#', $line, $matches)) {
406416
continue;
407417
}
408418

409419
$device = $matches[1];
410420

411-
// Skip the main terminal device
412-
if ($device === '/dev/ttys000') {
421+
// Skip the main terminal device for this PHP process
422+
if ($currentTty && $device === $currentTty) {
413423
continue;
414424
}
415425

0 commit comments

Comments
 (0)