@@ -10,7 +10,7 @@ import {
10
10
isParentPath ,
11
11
pathExists ,
12
12
pathExistsSync ,
13
- readFileSync ,
13
+ readFile ,
14
14
shellExecute ,
15
15
} from '../externalDependencies' ;
16
16
import { getEnvironmentDirFromPath } from '../commonUtils' ;
@@ -63,7 +63,7 @@ async function isLocalPoetryEnvironment(interpreterPath: string): Promise<boolea
63
63
return false ;
64
64
}
65
65
const project = path . dirname ( envDir ) ;
66
- if ( ! hasValidPyprojectToml ( project ) ) {
66
+ if ( ! ( await hasValidPyprojectToml ( project ) ) ) {
67
67
return false ;
68
68
}
69
69
// The assumption is that we need to be able to run poetry CLI for an environment in order to mark it as poetry.
@@ -126,7 +126,7 @@ export class Poetry {
126
126
*/
127
127
public static async getPoetry ( cwd : string ) : Promise < Poetry | undefined > {
128
128
// Following check should be performed synchronously so we trigger poetry execution as soon as possible.
129
- if ( ! hasValidPyprojectToml ( cwd ) ) {
129
+ if ( ! ( await hasValidPyprojectToml ( cwd ) ) ) {
130
130
// This check is not expensive and may change during a session, so we need not cache it.
131
131
return undefined ;
132
132
}
@@ -325,12 +325,12 @@ export async function isPoetryEnvironmentRelatedToFolder(
325
325
*
326
326
* @param folder Folder to look for pyproject.toml file in.
327
327
*/
328
- function hasValidPyprojectToml ( folder : string ) : boolean {
328
+ async function hasValidPyprojectToml ( folder : string ) : Promise < boolean > {
329
329
const pyprojectToml = path . join ( folder , 'pyproject.toml' ) ;
330
330
if ( ! pathExistsSync ( pyprojectToml ) ) {
331
331
return false ;
332
332
}
333
- const content = readFileSync ( pyprojectToml ) ;
333
+ const content = await readFile ( pyprojectToml ) ;
334
334
if ( ! content . includes ( '[tool.poetry]' ) ) {
335
335
return false ;
336
336
}
0 commit comments