(cwd: string, executable: string, target: string, autorun: string[])
| 227 | } |
| 228 | |
| 229 | attach(cwd: string, executable: string, target: string, autorun: string[]): Thenable<any> { |
| 230 | return new Promise((resolve, reject) => { |
| 231 | let args = []; |
| 232 | if (executable && !path.isAbsolute(executable)) |
| 233 | executable = path.join(cwd, executable); |
| 234 | args = this.preargs.concat(this.extraargs || []); |
| 235 | this.process = ChildProcess.spawn(this.application, args, { cwd: cwd, env: this.procEnv }); |
| 236 | this.process.stdout.on("data", this.stdout.bind(this)); |
| 237 | this.process.stderr.on("data", this.stderr.bind(this)); |
| 238 | this.process.on("exit", (() => { this.emit("quit"); }).bind(this)); |
| 239 | this.process.on("error", ((err) => { this.emit("launcherror", err); }).bind(this)); |
| 240 | const promises = this.initCommands(target, cwd, true); |
| 241 | if (target.startsWith("extended-remote")) { |
| 242 | promises.push(this.sendCommand("target-select " + target)); |
| 243 | if (executable) |
| 244 | promises.push(this.sendCommand("file-symbol-file \"" + escape(executable) + "\"")); |
| 245 | } else { |
| 246 | // Attach to local process |
| 247 | if (executable) |
| 248 | promises.push(this.sendCommand("file-exec-and-symbols \"" + escape(executable) + "\"")); |
| 249 | promises.push(this.sendCommand("target-attach " + target)); |
| 250 | } |
| 251 | promises.push(...autorun.map(value => { return this.sendUserInput(value); })); |
| 252 | Promise.all(promises).then(() => { |
| 253 | this.emit("debug-ready"); |
| 254 | resolve(undefined); |
| 255 | }, reject); |
| 256 | }); |
| 257 | } |
| 258 | |
| 259 | connect(cwd: string, executable: string, target: string, autorun: string[]): Thenable<any> { |
| 260 | return new Promise((resolve, reject) => { |
nothing calls this directly
no test coverage detected