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

Commit d273190

Browse files
authored
Merge pull request #1003 from microsoft/fix-serialport-ubuntu
fix serialport list on ubuntu
2 parents c770700 + ba3ce3a commit d273190

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/serialmonitor/serialportctrl.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ export class SerialPortCtrl {
2020
return SerialPortCtrl._serialport;
2121
}
2222

23-
public static list(): Promise<ISerialPortDetail[]> {
24-
return new Promise((resolve, reject) => {
25-
SerialPortCtrl.serialport.list().then(
26-
(ports) => resolve(ports),
27-
(err) => reject(err),
28-
);
29-
});
23+
public static async list(): Promise<ISerialPortDetail[]> {
24+
try {
25+
const lists = SerialPortCtrl.serialport.list();
26+
return lists;
27+
} catch (err) {
28+
throw err;
29+
}
3030
}
3131

3232
private static _serialport: any;

0 commit comments

Comments
 (0)