mirror of
https://github.com/ivabus/gui
synced 2025-06-07 15:50:27 +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) => {
|
child.stderr.on("data", (data) => {
|
||||||
try {
|
try {
|
||||||
const msg = JSON.parse(data.toString().trim());
|
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);
|
progressNotifier(msg);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
//swallow it
|
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) => {
|
child.on("exit", (code) => {
|
||||||
|
@ -83,7 +94,7 @@ function newInstallProgressNotifier(full_name: string, notifyMainWindow: MainWin
|
||||||
let currentPackageNumber = 0;
|
let currentPackageNumber = 0;
|
||||||
|
|
||||||
return function (msg: any) {
|
return function (msg: any) {
|
||||||
if (msg.status !== "downloading") {
|
if (msg.status !== "downloading" && msg.status !== "installing") {
|
||||||
log.info("cli:", msg);
|
log.info("cli:", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue