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

Method startWithProgram

src/common.ts:807–830  ·  view source on GitHub ↗
(
        prog: string, args: readonly string[] = [],
        spawnOpts: childProcess.SpawnOptions = {}, cb: (line: string) => boolean = null)

Source from the content-addressed store, hash-verified

805 }
806
807 public startWithProgram(
808 prog: string, args: readonly string[] = [],
809 spawnOpts: childProcess.SpawnOptions = {}, cb: (line: string) => boolean = null): Promise<boolean> {
810 if (this.promise) { throw new Error('SpawnLineReader: can\'t reuse this object'); }
811 this.callback = cb;
812 this.promise = new Promise<boolean>((resolve) => {
813 try {
814 const child = childProcess.spawn(prog, args, spawnOpts);
815 child.on('error', (err) => {
816 this.emit('error', err);
817 resolve(false);
818 });
819 child.on('exit', (code: number, signal: string) => {
820 this.emit('exit', code, signal);
821 // read-line will resolve. Not us
822 });
823 this.doReadline(child.stdout, resolve);
824 }
825 catch (e) {
826 this.emit('error', e);
827 }
828 });
829 return this.promise;
830 }
831
832 public startWithStream(rStream: stream.Readable, cb: (line: string) => boolean = null): Promise<boolean> {
833 if (this.promise) { throw new Error('SpawnLineReader: can\'t reuse this object'); }

Callers 1

loadFromObjdumpAndNmMethod · 0.95

Calls 1

doReadlineMethod · 0.95

Tested by

no test coverage detected