Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F4433476
tty_readstream_da_timeout_child.cjs
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
652 B
Referenced Files
None
Subscribers
None
tty_readstream_da_timeout_child.cjs
View Options
const { openSync } = require('fs');
const tty = require('tty');
const fd = openSync('/dev/tty', 'r');
const stream = new tty.ReadStream(fd);
stream.setRawMode(true);
let settled = false;
stream.on('data', (data) => {
if (settled) {
return;
}
settled = true;
try { stream.setRawMode(false); } catch {}
console.log('DATA', JSON.stringify(Buffer.from(data).toString('latin1')));
process.exit(0);
});
process.stdout.write('READY\n');
process.stdout.write('\x1b[c');
setTimeout(() => {
if (settled) {
return;
}
settled = true;
try { stream.setRawMode(false); } catch {}
console.log('TIMEOUT');
process.exit(2);
}, 100);
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Sat, May 2, 5:41 AM (1 d, 21 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
543567
Default Alt Text
tty_readstream_da_timeout_child.cjs (652 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment