| Server IP : 107.13.46.68 / Your IP : 216.73.216.232 Web Server : Apache/2.4.58 (Ubuntu) System : Linux mariOS 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec 5 13:09:44 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/nodejs/libtap/lib/ |
Upload File : |
'use strict'
const ownOr = require('own-or')
const Base = require('./base.js')
class Stdin extends Base {
constructor (options) {
options = options || {}
options.name = ownOr(options, 'name', '/dev/stdin')
super(options)
// This has to be here for node 0.10's wonky streams
this.stream = ownOr(options, 'tapStream', process.stdin)
this.stream.pause()
}
main (cb) {
this.stream.on('error', er => {
er.tapCaught = 'stdinError'
this.threw(er)
})
this.setTimeout(this.options.timeout)
this.stream.pipe(this.parser)
if (this.parent)
this.parent.emit('stdin', this)
this.stream.resume()
this.once('end', cb)
}
threw (er, extra, proxy) {
extra = super.threw(er, extra, proxy)
this.options = extra
this.parser.abort(er.message, extra)
this.parser.end()
}
}
module.exports = Stdin