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

Method init

src/backend/server.ts:52–98  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50 }
51
52 public init(): Thenable<any> {
53 return new Promise(async (resolve, reject) => {
54 if (this.application !== null) {
55 this.initResolve = resolve;
56 this.initReject = reject;
57 try {
58 await this.connectToConsole();
59 }
60 catch (e) {
61 ServerConsoleLog('GDBServer: Could not connect to console: ' + e);
62 reject(e);
63 }
64 this.process = ChildProcess.spawn(this.application, this.args, { cwd: this.cwd });
65 currentServers.push(this);
66 this.pid = this.process.pid;
67 this.process.stdout.on('data', this.onStdout.bind(this));
68 this.process.stderr.on('data', this.onStderr.bind(this));
69 this.process.on('exit', this.onExit.bind(this));
70 this.process.on('error', this.onError.bind(this));
71
72 if (this.application.indexOf('st-util') !== -1 && os.platform() === 'win32') {
73 // For some reason we are not able to capture the st-util output on Windows
74 // For now assume that it will launch properly within 1/2 second and resolve the init
75 setTimeout(() => {
76 if (this.initResolve) {
77 this.initResolve(true);
78 this.initReject = null;
79 this.initResolve = null;
80 }
81 }, 500);
82 }
83 if (this.initMatch == null) {
84 // If there is no init match string (e.g. QEMU) assume launch in 100 ms and resolve
85 setTimeout(() => {
86 if (this.initResolve) {
87 this.initResolve(true);
88 this.initReject = null;
89 this.initResolve = null;
90 }
91 }, 100);
92 }
93 }
94 else { // For servers like BMP that are always running directly on the probe
95 resolve(true);
96 }
97 });
98 }
99
100 public isExternal(): boolean {
101 return !this.application;

Callers

nothing calls this directly

Calls 2

connectToConsoleMethod · 0.95
ServerConsoleLogFunction · 0.85

Tested by

no test coverage detected