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

Commit b28f574

Browse files
hlovdaladiazulay
authored andcommitted
Unify util.spawn invocation
1 parent a6968e0 commit b28f574

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/arduino/arduino.ts

+14-9
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,11 @@ export class ArduinoApp {
205205
const msg = "Output path is not specified. Unable to reuse previously compiled files. Upload could be slow. See README.";
206206
arduinoChannel.warning(msg);
207207
}
208-
await util.spawn(this._settings.commandPath, arduinoChannel.channel, args).then(async () => {
208+
await util.spawn(
209+
this._settings.commandPath,
210+
arduinoChannel.channel,
211+
args,
212+
).then(async () => {
209213
UsbDetector.getInstance().resumeListening();
210214
if (needRestore) {
211215
await serialMonitor.openSerialMonitor();
@@ -283,22 +287,23 @@ export class ArduinoApp {
283287
let success = false;
284288
const compilerParserContext = makeCompilerParserContext(dc);
285289

286-
try {
287-
await util.spawn(this._settings.commandPath,
288-
arduinoChannel.channel,
289-
args,
290-
undefined,
291-
compilerParserContext.callback);
290+
await util.spawn(
291+
this._settings.commandPath,
292+
arduinoChannel.channel,
293+
args,
294+
undefined,
295+
compilerParserContext.callback,
296+
).then(() => {
292297
arduinoChannel.end(`Finished verifying sketch - ${dc.sketch}${os.EOL}`);
293298
success = true;
294-
} catch (reason) {
299+
}, (reason) => {
295300
const msg = reason.code ?
296301
`Exit with code=${reason.code}${os.EOL}` :
297302
reason.message ?
298303
reason.message :
299304
JSON.stringify(reason);
300305
arduinoChannel.error(msg);
301-
}
306+
});
302307

303308
if (compilerParserContext.conclude) {
304309
compilerParserContext.conclude();

0 commit comments

Comments
 (0)