"use strict";
// Lifted from: https://github.com/oclif/oclif/issues/245#issuecomment-604413364
// in 
// https://github.com/hackmdio/hackmd-cli
// 
// https://github.com/hackmdio/hackmd-cli/blob/f4779995ad2a05aab676bcefa471df8886710624/src/read-stdin-stream.ts
// https://github.com/hackmdio/hackmd-cli/blob/f4779995ad2a05aab676bcefa471df8886710624/src/index.ts#L18-L20
Object.defineProperty(exports, "__esModule", { value: true });
const readStdin = () => {
    return new Promise(resolve => {
        const stdin = process.openStdin();
        stdin.setEncoding('utf-8');
        let data;
        stdin.on('data', chunk => {
            if (data == undefined)
                data = '';
            data += chunk;
        });
        stdin.on('end', () => {
            resolve(data);
        });
        stdin.on('error', (err) => {
            resolve(undefined);
        });
        if (stdin.isTTY) {
            resolve(undefined);
        }
    });
};
exports.default = readStdin;
//# sourceMappingURL=read-stdin.js.map