MCPcopy Create free account
hub / github.com/Marus/cortex-debug / doReadline

Method doReadline

src/common.ts:857–885  ·  view source on GitHub ↗
(rStream: stream.Readable, resolve)

Source from the content-addressed store, hash-verified

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

Callers 3

startWithProgramMethod · 0.95
startWithStreamMethod · 0.95
startWithFileMethod · 0.95

Calls 1

closeMethod · 0.65

Tested by

no test coverage detected