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

Method createLogFile

src/frontend/server_console.ts:155–186  ·  view source on GitHub ↗
(logFileName: string)

Source from the content-addressed store, hash-verified

153 }
154
155 public createLogFile(logFileName: string) {
156 this.logFName = logFileName;
157 const showErr = !!this.logFName;
158
159 if (consoleLogFd >= 0) {
160 try {
161 fs.closeSync(consoleLogFd);
162 }
163 finally {
164 consoleLogFd = -1;
165 }
166 }
167
168 try {
169 if (this.logFName) {
170 const dir = path.dirname(this.logFName);
171 if (dir) {
172 fs.mkdirSync(dir, { recursive: true });
173 }
174 this.logFName = this.logFName.replace('${PID}', process.pid.toString());
175 } else {
176 const tmpdir = os.tmpdir();
177 this.logFName = `${tmpdir}/gdb-server-console-${process.pid}.log`;
178 }
179 consoleLogFd = fs.openSync(this.logFName, 'w');
180 }
181 catch (error) {
182 if (showErr) {
183 vscode.window.showErrorMessage(`Could not open log file: ${this.logFName}\n${error}`);
184 }
185 }
186 }
187
188 public isServerAlive() {
189 return this.toBackendServer !== null;

Callers 2

constructorMethod · 0.95
settingsChangedMethod · 0.80

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected