File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,24 @@ export default async function findPython(): Promise<string | undefined> {
7878 }
7979
8080 // Check python extension for any python environments with version >= 3.9
81- pythonPath = await findPythonInPythonExtension ( ) ;
81+ const awaitFind = findPythonInPythonExtension ( ) ;
82+ // Timeout after 30s, as it can stall if there is no python available
83+ const onTimeout = new Promise < string > ( ( resolve ) => {
84+ setTimeout ( resolve , 30000 , "timeout" ) ;
85+ } ) ;
86+
87+ await Promise . race ( [ awaitFind , onTimeout ] ) . then ( ( value ) => {
88+ if ( value === "timeout" ) {
89+ Logger . warn (
90+ LoggerSource . pythonHelper ,
91+ "Python Extension search timed out - attempting download instead"
92+ ) ;
93+ pythonPath = undefined ;
94+ } else {
95+ pythonPath = value ;
96+ }
97+ } ) ;
98+
8299 if ( pythonPath ) {
83100 await Settings . getInstance ( ) ?. updateGlobal (
84101 SettingsKey . python3Path ,
You can’t perform that action at this time.
0 commit comments