Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F4413843
process_stdin_setencoding_tty_child.cjs
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
737 B
Referenced Files
None
Subscribers
None
process_stdin_setencoding_tty_child.cjs
View Options
function cleanup() {
try { process.stdin.setRawMode(false); } catch {}
try { process.stdin.pause(); } catch {}
}
if (!process.stdin.isTTY || typeof process.stdin.setRawMode !== 'function') {
console.log('SKIP');
process.exit(0);
}
process.stdin.setRawMode(true);
process.stdin.setEncoding('utf8');
process.stdin.resume();
process.stdout.write('READY\n');
const timeout = setTimeout(() => {
cleanup();
console.log('TIMEOUT');
process.exit(3);
}, 2000);
process.stdin.on('data', chunk => {
clearTimeout(timeout);
cleanup();
if (typeof chunk !== 'string') {
console.log('TYPE', typeof chunk);
process.exit(4);
}
console.log('DATA', JSON.stringify(chunk));
process.exit(chunk === 'A€' ? 0 : 5);
});
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Fri, May 1, 9:00 PM (1 d, 21 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
542179
Default Alt Text
process_stdin_setencoding_tty_child.cjs (737 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment