mirror of
https://github.com/ivabus/gui
synced 2025-04-23 05:57:11 +03:00
handle stderr from cli better (#630)
Co-authored-by: Neil <get.neilmolina@gmail.com>
This commit is contained in:
parent
c5d9b3bc46
commit
0d9ac5e30e
1 changed files with 18 additions and 7 deletions
|
@ -44,13 +44,24 @@ export async function installPackage(
|
|||
|
||||
child.stderr.on("data", (data) => {
|
||||
try {
|
||||
const msg = JSON.parse(data.toString().trim());
|
||||
progressNotifier(msg);
|
||||
} catch (err) {
|
||||
//swallow it
|
||||
}
|
||||
data
|
||||
.toString()
|
||||
.split("\n")
|
||||
.map((s: string) => s.trim())
|
||||
.filter((s: string) => s.length > 0)
|
||||
.forEach((line) => {
|
||||
try {
|
||||
const msg = JSON.parse(line.trim());
|
||||
progressNotifier(msg);
|
||||
} catch (err) {
|
||||
log.error("handling cli notification line", line, err);
|
||||
}
|
||||
});
|
||||
|
||||
stderr += data.toString().trim();
|
||||
stderr += data.toString();
|
||||
} catch (err) {
|
||||
log.error("error processing cli data", data.toString(), err);
|
||||
}
|
||||
});
|
||||
|
||||
child.on("exit", (code) => {
|
||||
|
@ -83,7 +94,7 @@ function newInstallProgressNotifier(full_name: string, notifyMainWindow: MainWin
|
|||
let currentPackageNumber = 0;
|
||||
|
||||
return function (msg: any) {
|
||||
if (msg.status !== "downloading") {
|
||||
if (msg.status !== "downloading" && msg.status !== "installing") {
|
||||
log.info("cli:", msg);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue