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

Method load

src/backend/mi2/mi2.ts:51–92  ·  view source on GitHub ↗
(cwd: string, target: string, procArgs: string, separateConsole: string, autorun: string[])

Source from the content-addressed store, hash-verified

49 }
50
51 load(cwd: string, target: string, procArgs: string, separateConsole: string, autorun: string[]): Thenable<any> {
52 if (!path.isAbsolute(target))
53 target = path.join(cwd, target);
54 return new Promise((resolve, reject) => {
55 this.isSSH = false;
56 const args = this.preargs.concat(this.extraargs || []);
57 this.process = ChildProcess.spawn(this.application, args, { cwd: cwd, env: this.procEnv });
58 this.process.stdout.on("data", this.stdout.bind(this));
59 this.process.stderr.on("data", this.stderr.bind(this));
60 this.process.on("exit", (() => { this.emit("quit"); }).bind(this));
61 this.process.on("error", ((err) => { this.emit("launcherror", err); }).bind(this));
62 const promises = this.initCommands(target, cwd);
63 if (procArgs && procArgs.length)
64 promises.push(this.sendCommand("exec-arguments " + procArgs));
65 if (process.platform == "win32") {
66 if (separateConsole !== undefined)
67 promises.push(this.sendCommand("gdb-set new-console on"));
68 promises.push(...autorun.map(value => { return this.sendUserInput(value); }));
69 Promise.all(promises).then(() => {
70 this.emit("debug-ready");
71 resolve(undefined);
72 }, reject);
73 } else {
74 if (separateConsole !== undefined) {
75 linuxTerm.spawnTerminalEmulator(separateConsole).then(tty => {
76 promises.push(this.sendCommand("inferior-tty-set " + tty));
77 promises.push(...autorun.map(value => { return this.sendUserInput(value); }));
78 Promise.all(promises).then(() => {
79 this.emit("debug-ready");
80 resolve(undefined);
81 }, reject);
82 });
83 } else {
84 promises.push(...autorun.map(value => { return this.sendUserInput(value); }));
85 Promise.all(promises).then(() => {
86 this.emit("debug-ready");
87 resolve(undefined);
88 }, reject);
89 }
90 }
91 });
92 }
93
94 ssh(args: SSHArguments, cwd: string, target: string, procArgs: string, separateConsole: string, attach: boolean, autorun: string[]): Thenable<any> {
95 return new Promise((resolve, reject) => {

Callers

nothing calls this directly

Calls 3

initCommandsMethod · 0.95
sendCommandMethod · 0.95
sendUserInputMethod · 0.95

Tested by

no test coverage detected