aqua/npm/index.js

33 lines
657 B
JavaScript
Raw Normal View History

#!/usr/bin/env node
"use strict";
2022-04-14 12:04:43 +00:00
handleEPIPE(process.stderr)
handleEPIPE(process.stdout)
function handleEPIPE(stream) {
stream.on('error', onerror)
function onerror(err) {
if (err.code === 'EPIPE') {
stream._write = noopWrite
stream._writev = noopWritev
stream._read = noopRead
return stream.removeListener('error', onerror)
2022-04-13 08:38:18 +00:00
}
2022-04-14 12:04:43 +00:00
if (EE.listenerCount(stream, 'error') === 1) {
stream.removeListener('error', onerror)
stream.emit('error', err)
}
}
}
function noopWrite(chunk, enc, cb) {
cb()
}
function noopRead() {
this.push('')
}
function noopWritev(chunks, cb) {
cb()
}
2022-04-13 08:38:18 +00:00
2021-10-13 08:10:10 +00:00
import "./aqua.js";