Skip to content

Commit

Permalink
Add more shell exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
rashil2000 committed Oct 19, 2021
1 parent a2be7f4 commit 15ec7b3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions winfetch.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env pwsh
#requires -version 5

<#PSScriptInfo
Expand Down Expand Up @@ -604,10 +605,11 @@ function info_resolution {
# ===== TERMINAL =====
# this section works by getting the parent processes of the current powershell instance.
function info_terminal {
$programs = 'powershell', 'pwsh', 'winpty-agent', 'cmd', 'zsh', 'bash', 'fish', 'env', 'nu', 'elvish', 'csh', 'tcsh', 'python', 'xonsh'
if ($PSVersionTable.PSEdition.ToString() -ne 'Core') {
$parent = Get-Process -Id (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId = $PID" -Property ParentProcessId -CimSession $cimSession).ParentProcessId -ErrorAction Ignore
for () {
if ($parent.ProcessName -in 'powershell', 'pwsh', 'winpty-agent', 'cmd', 'zsh', 'bash') {
if ($parent.ProcessName -in $programs) {
$parent = Get-Process -Id (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId = $($parent.ID)" -Property ParentProcessId -CimSession $cimSession).ParentProcessId -ErrorAction Ignore
continue
}
Expand All @@ -616,7 +618,7 @@ function info_terminal {
} else {
$parent = (Get-Process -Id $PID).Parent
for () {
if ($parent.ProcessName -in 'powershell', 'pwsh', 'winpty-agent', 'cmd', 'zsh', 'bash') {
if ($parent.ProcessName -in $programs) {
$parent = (Get-Process -Id $parent.ID).Parent
continue
}
Expand Down

0 comments on commit 15ec7b3

Please sign in to comment.