File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -141,11 +141,19 @@ def _get_plugin_tsc_version():
141141 cmd = [get_node_path (), TSC_PATH , "-v" ]
142142 return _execute_cmd_and_parse_version_from_output (cmd )
143143
144+ def _is_executable (path ):
145+ return os .path .isfile (path ) and os .access (path , os .X_OK )
146+
144147def _get_npm_tsc_version ():
145- cmd = ["tsc" , "-v" ]
148+ if os .name != 'nt' and _is_executable ("/usr/local/bin/tsc" ): # Default location on MacOS
149+ cmd = [get_node_path (), "/usr/local/bin/tsc" , "-v" ]
150+ else :
151+ cmd = ["tsc" , "-v" ]
146152 return _execute_cmd_and_parse_version_from_output (cmd )
147153
148154def _execute_cmd_and_parse_version_from_output (cmd ):
155+ if os .name != 'nt' : # Linux/MacOS
156+ cmd = "'" + "' '" .join (cmd ) + "'"
149157 output = subprocess .check_output (cmd , shell = True ).decode ('UTF-8' )
150158
151159 # Use regex to parse the verion number from <output> e.g. parse
You can’t perform that action at this time.
0 commit comments