diff options
author | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
---|---|---|
committer | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /meson/mesonbuild/scripts/cmd_or_ps.ps1 | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/mesonbuild/scripts/cmd_or_ps.ps1')
-rw-r--r-- | meson/mesonbuild/scripts/cmd_or_ps.ps1 | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/meson/mesonbuild/scripts/cmd_or_ps.ps1 b/meson/mesonbuild/scripts/cmd_or_ps.ps1 new file mode 100644 index 000000000..ccef8e84d --- /dev/null +++ b/meson/mesonbuild/scripts/cmd_or_ps.ps1 @@ -0,0 +1,22 @@ +# Copyied from GStreamer project +# Author: Seungha Yang <seungha.yang@navercorp.com> + +$i=1 +$ppid=(gwmi win32_process -Filter "processid='$pid'").parentprocessid +$pname=(Get-Process -id $ppid).Name +While($true) { + if($pname -eq "cmd" -Or $pname -eq "powershell") { + Write-Host ("{0}.exe" -f $pname) + Break + } + + # 10 times iteration seems to be sufficient + if($i -gt 10) { + Break + } + + # not found yet, find grand parant + $ppid=(gwmi win32_process -Filter "processid='$ppid'").parentprocessid + $pname=(Get-Process -id $ppid).Name + $i++ +} |