MCPcopy Create free account
hub / github.com/WebFreak001/code-debug / connect

Method connect

src/backend/mi2/mi2.ts:259–280  ·  view source on GitHub ↗
(cwd: string, executable: string, target: string, autorun: string[])

Source from the content-addressed store, hash-verified

257 }
258
259 connect(cwd: string, executable: string, target: string, autorun: string[]): Thenable<any> {
260 return new Promise((resolve, reject) => {
261 let args = [];
262 if (executable && !path.isAbsolute(executable))
263 executable = path.join(cwd, executable);
264 args = this.preargs.concat(this.extraargs || []);
265 if (executable)
266 args = args.concat([executable]);
267 this.process = ChildProcess.spawn(this.application, args, { cwd: cwd, env: this.procEnv });
268 this.process.stdout.on("data", this.stdout.bind(this));
269 this.process.stderr.on("data", this.stderr.bind(this));
270 this.process.on("exit", (() => { this.emit("quit"); }).bind(this));
271 this.process.on("error", ((err) => { this.emit("launcherror", err); }).bind(this));
272 const promises = this.initCommands(target, cwd, true);
273 promises.push(this.sendCommand("target-select remote " + target));
274 promises.push(...autorun.map(value => { return this.sendUserInput(value); }));
275 Promise.all(promises).then(() => {
276 this.emit("debug-ready");
277 resolve(undefined);
278 }, reject);
279 });
280 }
281
282 stdout(data) {
283 if (trace)

Callers

nothing calls this directly

Calls 3

initCommandsMethod · 0.95
sendCommandMethod · 0.95
sendUserInputMethod · 0.95

Tested by

no test coverage detected