-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdebug_pty.sh
More file actions
executable file
·35 lines (27 loc) · 1002 Bytes
/
debug_pty.sh
File metadata and controls
executable file
·35 lines (27 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# Capture raw PTY output from claude CLI
OUTPUT_FILE="claude_raw_output.bin"
echo "Recording claude output to $OUTPUT_FILE"
echo "Type some commands, then Ctrl+D or 'exit' to finish"
echo "---"
# Record raw terminal session
script -q "$OUTPUT_FILE" /Users/aquintanar/.local/bin/claude
echo "---"
echo "Raw output saved to $OUTPUT_FILE"
echo ""
echo "Analyzing output..."
echo ""
# Show hex dump of first 2000 bytes
echo "=== HEX DUMP (first 2000 bytes) ==="
xxd "$OUTPUT_FILE" | head -125
echo ""
echo "=== ESCAPE SEQUENCES FOUND ==="
# Find escape sequences (ESC = 0x1b)
grep -o $'\x1b\[[^m]*m\|\x1b\[[0-9;]*[A-Za-z]' "$OUTPUT_FILE" | sort | uniq -c | sort -rn | head -30
echo ""
echo "=== CARRIAGE RETURNS AND NEWLINES ==="
echo "CR (\\r) count: $(grep -c $'\r' "$OUTPUT_FILE" || echo 0)"
echo "LF (\\n) count: $(grep -c $'\n' "$OUTPUT_FILE" || echo 0)"
echo "CRLF (\\r\\n) count: $(grep -c $'\r\n' "$OUTPUT_FILE" || echo 0)"
echo ""
echo "Full hex dump: xxd $OUTPUT_FILE | less"