I have a python application that has a shell that needs to do some tweaking depending on whether the shell is running on a Windows command line (CMD) or Powershell.
I was not able to figure out how to determine if the application is running in powershell or cmd.
From my searches on stackoverflow and Google, it seems the only way to do this is to use psutil to find the name of the parent process.
Is there a better way?
Edit: I decided to use psutil to find the name of the parent process. Thanks to everyone who helped in the comments.
source share