3 ms·
I did the same exercise, and I found this immediately (straight drilldown through directories from the top level): https://github.com/PowerShell/PowerShell/blo
by barrkel 10y ago
I did the same exercise, and I found this immediately (straight drilldown through directories from the top level):
https://github.com/PowerShell/PowerShell/blob/master/src/powershell-native/nativemsh/pwrshexe/MainEntry.cpp https://github.com/PowerShell/PowerShell/blob/master/src/pow...
It's instantiating the execution engine (.NET-speak for the core runtime) getting ready to run Monad (the original codename for PowerShell).
I think part of it is familiarity and context. I knew none of the command bits would be likely to contain an entrypoint. Directories that mentioned native looked useful for finding an entrypoint, because I know that PowerShell is implemented in C# - I reasoned I'd be able to find further managed entrypoints by looking at where it starts out in C++.
You can see that the main object it instantiates is Microsoft.PowerShell.UnmanagedPSEntry. Looks useful.
A search across the repo for UnmanagedPSEntry lead me to https://github.com/PowerShell/PowerShell/tree/master/src/Microsoft.PowerShell.ConsoleHost/host/msh https://github.com/PowerShell/PowerShell/tree/master/src/Mic... which seems to contain all the entrypoints you're looking for.
The main loop is in InputLoop in https://github.com/PowerShell/PowerShell/blob/master/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs https://github.com/PowerShell/PowerShell/blob/master/src/Mic...
(FTR, this took me about 8 minutes, including finding links that didn't include hashes.)