Issues fixed:
- GameProcessServer.readProcessOutput() was using fgets() which could cause
line breaks to be mishandled when reading multiple lines at once
- Changed to use fread() with 8KB buffer for non-blocking I/O
- fread() is better for interactive programs
- Properly handles newlines within chunks
- Doesn't break lines unnecessarily
Frontend improvements:
- Changed sendInput() to use terminal.writeln() instead of write() + write('\n')
- Ensures consistent line ending handling
- Cleaner terminal output
Changes:
1. GameProcessServer.php (readProcessOutput):
- Replaced fgets() loop with fread() loops
- 8192-byte buffer size for optimal performance
- Better handles non-blocking I/O streams
2. web/process.html (sendInput):
- Use terminal.writeln() for user input display
- More consistent with xterm.js behavior
Results:
- Line breaks now display correctly
- Output formatting preserved
- Better handling of rapid output
- No double line breaks
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
||
|---|---|---|
| .idea | ||
| bin | ||
| src | ||
| test | ||
| web | ||
| .DS_Store | ||
| .gitignore | ||
| box.json | ||
| build-phar.php | ||
| build.sh | ||
| composer.json | ||
| composer.lock | ||
| save.json | ||
| start-server.sh | ||
| websocket-process-server.php | ||
| websocket-server.php | ||