(data: Buffer)
| 36 | let checkFinished = false; |
| 37 | |
| 38 | const handleData = (data: Buffer) => { |
| 39 | responseBuffer += data.toString(); |
| 40 | |
| 41 | // Check for progressive enhancement response (CSI ? <flags> u) |
| 42 | if (responseBuffer.includes('\x1b[?') && responseBuffer.includes('u')) { |
| 43 | progressiveEnhancementReceived = true; |
| 44 | } |
| 45 | |
| 46 | // Check for device attributes response (CSI ? <attrs> c) |
| 47 | if (responseBuffer.includes('\x1b[?') && responseBuffer.includes('c')) { |
| 48 | if (!checkFinished) { |
| 49 | checkFinished = true; |
| 50 | process.stdin.removeListener('data', handleData); |
| 51 | |
| 52 | if (!originalRawMode) { |
| 53 | process.stdin.setRawMode(false); |
| 54 | } |
| 55 | |
| 56 | if (progressiveEnhancementReceived) { |
| 57 | // Enable the protocol |
| 58 | process.stdout.write('\x1b[>1u'); |
| 59 | protocolSupported = true; |
| 60 | protocolEnabled = true; |
| 61 | |
| 62 | // Set up cleanup on exit |
| 63 | process.on('exit', disableProtocol); |
| 64 | process.on('SIGTERM', disableProtocol); |
| 65 | } |
| 66 | |
| 67 | detectionComplete = true; |
| 68 | resolve(protocolSupported); |
| 69 | } |
| 70 | } |
| 71 | }; |
| 72 | |
| 73 | process.stdin.on('data', handleData); |
| 74 |
nothing calls this directly
no outgoing calls
no test coverage detected