(rStream: stream.Readable, resolve)
| 855 | } |
| 856 | |
| 857 | private doReadline(rStream: stream.Readable, resolve) { |
| 858 | try { |
| 859 | const rl = readline.createInterface({ |
| 860 | input: rStream, |
| 861 | crlfDelay: Infinity, |
| 862 | console: false |
| 863 | }); |
| 864 | rl.on('line', (line) => { |
| 865 | if (this.callback) { |
| 866 | if (!this.callback(line)) { |
| 867 | rl.close(); |
| 868 | } |
| 869 | } else { |
| 870 | this.emit('line', line); |
| 871 | } |
| 872 | }); |
| 873 | rl.once('close', () => { |
| 874 | if (this.callback) { |
| 875 | this.callback(null); |
| 876 | } |
| 877 | rStream.destroy(); |
| 878 | this.emit('close'); |
| 879 | resolve(true); |
| 880 | }); |
| 881 | } |
| 882 | catch (e) { |
| 883 | this.emit('error', e); |
| 884 | } |
| 885 | } |
| 886 | } |
| 887 | |
| 888 | // Both arguments are expected to be full path names |
no test coverage detected