File tree Expand file tree Collapse file tree 1 file changed +19
-11
lines changed
packages/theme-language-server-node/src Expand file tree Collapse file tree 1 file changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -25,17 +25,25 @@ export async function fetchMetafieldDefinitionsForURI(uri: string) {
25
25
}
26
26
}
27
27
28
- // eslint-disable-next-line no-unused-vars
29
28
async function getShopifyCliPath ( ) {
30
- if ( isWin ) {
31
- const { stdout } = await exec ( `where.exe shopify` ) ;
32
- const executables = stdout
33
- . replace ( / \r / g, '' )
34
- . split ( '\n' )
35
- . filter ( ( exe ) => exe . endsWith ( 'bat' ) ) ;
36
- return executables . length > 0 ? executables [ 0 ] : '' ;
37
- } else {
38
- const { stdout } = await exec ( `which shopify` ) ;
39
- return stdout . split ( '\n' ) [ 0 ] . replace ( '\r' , '' ) ;
29
+ if ( process . env . NODE_ENV === 'test' ) {
30
+ return ;
31
+ }
32
+
33
+ try {
34
+ if ( isWin ) {
35
+ const { stdout } = await exec ( `where.exe shopify` ) ;
36
+ const executables = stdout
37
+ . replace ( / \r / g, '' )
38
+ . split ( '\n' )
39
+ . filter ( ( exe ) => exe . endsWith ( 'bat' ) ) ;
40
+ return executables . length > 0 ? executables [ 0 ] : '' ;
41
+ } else {
42
+ const { stdout } = await exec ( `which shopify` ) ;
43
+ return stdout . split ( '\n' ) [ 0 ] . replace ( '\r' , '' ) ;
44
+ }
45
+ } catch ( _ ) {
46
+ // If any errors occur while trying to find the CLI, we will silently return
47
+ return ;
40
48
}
41
49
}
You can’t perform that action at this time.
0 commit comments