MCPcopy
hub / github.com/PowerShell/vscode-powershell / handleFailedProcess

Method handleFailedProcess

src/session.ts:822–863  ·  view source on GitHub ↗
(
        powerShellProcess: PowerShellProcess,
    )

Source from the content-addressed store, hash-verified

820 // The process failed to start, so check for common user errors (generally
821 // out-of-support versions of PowerShell).
822 private async handleFailedProcess(
823 powerShellProcess: PowerShellProcess,
824 ): Promise<void> {
825 const version = await powerShellProcess.getVersionCli();
826 let shouldUpdate = true;
827
828 if (satisfies(version, "<5.1.0")) {
829 void this.setSessionFailedGetPowerShell(
830 `PowerShell v${version} is not supported, please update!`,
831 );
832 } else if (satisfies(version, ">=5.1.0 <6.0.0")) {
833 void this.setSessionFailedGetPowerShell(
834 "It looks like you're trying to use Windows PowerShell, which is supported on a best-effort basis. Can you try PowerShell 7?",
835 );
836 } else if (satisfies(version, ">=6.0.0 <7.4.0")) {
837 void this.setSessionFailedGetPowerShell(
838 `PowerShell v${version} has reached end-of-support, please update!`,
839 );
840 } else {
841 shouldUpdate = false;
842 void this.setSessionFailedOpenBug(
843 "PowerShell Language Server process didn't start!",
844 );
845 }
846
847 if (shouldUpdate) {
848 // Run the update notifier since it won't run later as we failed
849 // to start, but we have enough details to do so now.
850 const versionDetails: IPowerShellVersionDetails = {
851 version: version,
852 edition: "", // Unused by UpdatePowerShell
853 commit: version, // Actually used by UpdatePowerShell
854 architecture: process.arch, // Best guess based off Code's architecture
855 };
856 const updater = new UpdatePowerShell(
857 this.sessionSettings,
858 this.logger,
859 versionDetails,
860 );
861 void updater.checkForUpdate();
862 }
863 }
864
865 private sessionStarted(
866 sessionDetails: IEditorServicesSessionDetails,

Callers 1

startMethod · 0.95

Calls 4

checkForUpdateMethod · 0.95
getVersionCliMethod · 0.80

Tested by

no test coverage detected