Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit f9cd3c5

Browse files
elektronikworkshopadiazulay
authored andcommitted
Fix too early initialization of cocopa
* Fixed bug with build: initializing cocopa too early (was failing if sketch wasn't initialized) * More info in error message for uncaught exception during build cleanup * Note on output path preparation which seems to be a bit wonky
1 parent 48c4c64 commit f9cd3c5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/arduino/arduino.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export class ArduinoApp {
184184
this._building = false;
185185
logger.notifyUserError("ArduinoApp.build",
186186
reason,
187-
`Unhandled exception when cleaning up build (${buildMode}).`);
187+
`Unhandled exception when cleaning up build "${buildMode}": ${JSON.stringify(reason)}`);
188188
return false;
189189
});
190190
}
@@ -203,7 +203,6 @@ export class ArduinoApp {
203203
const dc = DeviceContext.getInstance();
204204
const args: string[] = [];
205205
let restoreSerialMonitor: boolean = false;
206-
const cocopa = makeCompilerParserContext(dc);
207206
const verbose = VscodeSettings.getInstance().logLevel === constants.LogLevel.Verbose;
208207

209208
if (!this.boardManager.currentBoard) {
@@ -330,6 +329,8 @@ export class ArduinoApp {
330329
arduinoChannel.start(`${buildMode} sketch '${dc.sketch}'`);
331330

332331
if ((buildDir || dc.output) && compile) {
332+
// 2020-02-29, EW: This whole code appears a bit wonky to me.
333+
// What if the user specifies an output directory "../builds/my project"
333334
buildDir = path.resolve(ArduinoWorkspace.rootPath, buildDir || dc.output);
334335
const dirPath = path.dirname(buildDir);
335336
if (!util.directoryExistsSync(dirPath)) {
@@ -381,6 +382,9 @@ export class ArduinoApp {
381382

382383
// Push sketch as last argument
383384
args.push(path.join(ArduinoWorkspace.rootPath, dc.sketch));
385+
386+
const cocopa = makeCompilerParserContext(dc);
387+
384388
const cleanup = async (result: "ok" | "error") => {
385389
let ret = true;
386390
if (result === "ok") {

0 commit comments

Comments
 (0)