diff --git a/src/detection/cpuusage/cpuusage.c b/src/detection/cpuusage/cpuusage.c index 40e569528..72393aa45 100644 --- a/src/detection/cpuusage/cpuusage.c +++ b/src/detection/cpuusage/cpuusage.c @@ -9,7 +9,8 @@ static uint64_t startTime; void ffPrepareCPUUsage(void) { - assert(cpuTimes1.elementSize == 0); + if (cpuTimes1.elementSize != 0) return; // Already prepared + ffListInit(&cpuTimes1, sizeof(FFCpuUsageInfo)); ffGetCpuUsageInfo(&cpuTimes1); startTime = ffTimeGetNow(); diff --git a/src/detection/diskio/diskio.c b/src/detection/diskio/diskio.c index 9413a7125..00f7bc244 100644 --- a/src/detection/diskio/diskio.c +++ b/src/detection/diskio/diskio.c @@ -11,6 +11,8 @@ void ffPrepareDiskIO(FFDiskIOOptions* options) { if (options->detectTotal) return; + if (time1 != 0) return; // Already prepared + ffListInit(&ioCounters1, sizeof(FFDiskIOResult)); ffDiskIOGetIoCounters(&ioCounters1, options); time1 = ffTimeGetNow(); diff --git a/src/detection/netio/netio.c b/src/detection/netio/netio.c index 666321c99..48d6ba7b1 100644 --- a/src/detection/netio/netio.c +++ b/src/detection/netio/netio.c @@ -9,6 +9,8 @@ void ffPrepareNetIO(FFNetIOOptions* options) { if (options->detectTotal) return; + if (time1 != 0) return; // Already prepared + ffListInit(&ioCounters1, sizeof(FFNetIOResult)); ffNetIOGetIoCounters(&ioCounters1, options); time1 = ffTimeGetNow(); diff --git a/src/fastfetch.c b/src/fastfetch.c index d0882b15e..60df8051f 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -811,6 +811,11 @@ static void run(FFdata* data) } else break; + + if (useJsonConfig) + ffPrintJsonConfig(data, true /* prepare */); + else + ffPrepareCommandOption(data); } if (data->resultDoc) diff --git a/src/logo/logo.c b/src/logo/logo.c index 2f009adc0..1bd6cb8e9 100644 --- a/src/logo/logo.c +++ b/src/logo/logo.c @@ -702,7 +702,7 @@ void ffLogoPrintLine(void) printf("\033[%uC", instance.state.logoWidth); if (instance.state.dynamicInterval > 0) - fputs("\033[K", stdout); + fputs("\033[K", stdout); // Clear to the end of the line ++instance.state.keysHeight; }