about-system 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "about-system",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "A Node.js script to display key system information with emojis. Cross-platform support for Windows, macOS, and Linux with customizable output and caching.",
5
5
  "main": "src/about-system.js",
6
6
  "bin": {
@@ -697,45 +697,8 @@ const infoFunctions = {
697
697
  top_process(settings) {
698
698
  const cached = getCachedValue(this.cache, 'top_process', settings);
699
699
  if (cached) return cached;
700
-
701
- if (IS_WINDOWS) {
702
- try {
703
- // Get top process using PowerShell performance counters
704
- const ps = execCommand('powershell.exe -Command "Get-Counter \'\\Process(*)\\% Processor Time\' | Select-Object -ExpandProperty CounterSamples | Where-Object {$_.InstanceName -notin @(\'_Total\', \'Idle\')} | Sort-Object CookedValue -Descending | Select-Object -First 1 | Select-Object InstanceName, @{Name=\'CPU%\'; Expression={[math]::Round($_.CookedValue, 1)}}"');
705
- const lines = ps.split('\n').filter(line => line.trim());
706
- if (lines.length > 0) {
707
- const parts = lines[0].trim().split(/\s+/);
708
- if (parts.length >= 2) {
709
- const processName = parts[0];
710
- const cpuPercent = parts[1];
711
- const color = colors[settings.colors.top_process] || colors.magenta;
712
- const emoji = settings.display.show_emojis ? '🔝 ' : '';
713
- const result = `${color}${emoji}${cpuPercent}% ${processName}`;
714
- setCachedValue(this.cache, 'top_process', result);
715
- return result;
716
- }
717
- }
718
- } catch {}
719
-
720
- // Fallback using tasklist
721
- try {
722
- const tasklist = execCommand('tasklist /fo csv | findstr /v "Image Name" | sort /r /+5');
723
- const lines = tasklist.split('\n').filter(line => line.trim());
724
- if (lines.length > 0) {
725
- const line = lines[0];
726
- const parts = line.split(',');
727
- if (parts.length >= 5) {
728
- const processName = parts[0].replace(/"/g, '').split('.')[0];
729
- const memoryUsage = parts[4].replace(/"/g, '').replace(/[,\s]/g, '');
730
- const color = colors[settings.colors.top_process] || colors.magenta;
731
- const emoji = settings.display.show_emojis ? '🔝 ' : '';
732
- const result = `${color}${emoji}${memoryUsage}KB ${processName}`;
733
- setCachedValue(this.cache, 'top_process', result);
734
- return result;
735
- }
736
- }
737
- } catch {}
738
- } else if (IS_LINUX) {
700
+
701
+ if (IS_LINUX) {
739
702
  try {
740
703
  const ps = execCommand('ps -eo pcpu,comm --sort=-%cpu --no-headers');
741
704
  const lines = ps.split('\n');