fix(respawn): use carriage return for PTY Enter key

Changed all command writes from \n (newline) to \r (carriage return).
PTY terminals expect \r for Enter key, \n only creates a new line
without executing the command.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-01-19 15:16:29 +01:00
co-authored by Claude Opus 4.5
parent c4660e271f
commit 5a27261e61
+4 -4
View File
@@ -355,7 +355,7 @@ export class RespawnController extends EventEmitter {
this.stepTimer = setTimeout(() => { this.stepTimer = setTimeout(() => {
const prompt = this.config.kickstartPrompt!; const prompt = this.config.kickstartPrompt!;
this.log(`Sending kickstart prompt: "${prompt}"`); this.log(`Sending kickstart prompt: "${prompt}"`);
this.session.write(prompt + '\n'); this.session.write(prompt + '\r'); // \r for PTY Enter key
this.emit('stepSent', 'kickstart', prompt); this.emit('stepSent', 'kickstart', prompt);
this.setState('waiting_kickstart'); this.setState('waiting_kickstart');
this.promptDetected = false; this.promptDetected = false;
@@ -416,7 +416,7 @@ export class RespawnController extends EventEmitter {
this.terminalBuffer = ''; // Clear buffer for fresh detection this.terminalBuffer = ''; // Clear buffer for fresh detection
this.stepTimer = setTimeout(() => { this.stepTimer = setTimeout(() => {
const input = this.config.updatePrompt + '\n'; const input = this.config.updatePrompt + '\r'; // \r for PTY Enter key
this.log(`Sending update prompt: "${this.config.updatePrompt}"`); this.log(`Sending update prompt: "${this.config.updatePrompt}"`);
this.session.write(input); this.session.write(input);
this.emit('stepSent', 'update', this.config.updatePrompt); this.emit('stepSent', 'update', this.config.updatePrompt);
@@ -432,7 +432,7 @@ export class RespawnController extends EventEmitter {
this.stepTimer = setTimeout(() => { this.stepTimer = setTimeout(() => {
this.log('Sending /clear'); this.log('Sending /clear');
this.session.write('/clear\n'); this.session.write('/clear\r'); // \r for PTY Enter key
this.emit('stepSent', 'clear', '/clear'); this.emit('stepSent', 'clear', '/clear');
this.setState('waiting_clear'); this.setState('waiting_clear');
this.promptDetected = false; this.promptDetected = false;
@@ -445,7 +445,7 @@ export class RespawnController extends EventEmitter {
this.stepTimer = setTimeout(() => { this.stepTimer = setTimeout(() => {
this.log('Sending /init'); this.log('Sending /init');
this.session.write('/init\n'); this.session.write('/init\r'); // \r for PTY Enter key
this.emit('stepSent', 'init', '/init'); this.emit('stepSent', 'init', '/init');
this.setState('waiting_init'); this.setState('waiting_init');
this.promptDetected = false; this.promptDetected = false;