File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -775,16 +775,23 @@ pub fn try_find_tsgolint_executable(cwd: &Path) -> Result<PathBuf, String> {
775775 ) ) ;
776776 }
777777
778- // executing a sub command in windows, needs a `cmd` or `ps1` extension.
779- // `cmd` is the most compatible one with older systems
780- let file = if cfg ! ( windows) { "tsgolint.CMD" } else { "tsgolint" } ;
778+ // Executing a sub-command in Windows needs a `cmd` or `ps1` extension.
779+ // Since `cmd` is the most compatible one with older systems, we use that one first,
780+ // then check for `exe` which is also common. Bun, for example, does not create a `cmd`
781+ // file but still produces an `exe` file (https://github.com/oxc-project/oxc/issues/13784).
782+ #[ cfg( windows) ]
783+ let files = & [ "tsgolint.CMD" , "tsgolint.exe" ] ;
784+ #[ cfg( not( windows) ) ]
785+ let files = & [ "tsgolint" ] ;
781786
782787 // Move upwards until we find a `package.json`, then look at `node_modules/.bin/tsgolint`
783788 let mut current_dir = cwd. to_path_buf ( ) ;
784789 loop {
785- let node_modules_bin = current_dir. join ( "node_modules" ) . join ( ".bin" ) . join ( file) ;
786- if node_modules_bin. exists ( ) {
787- return Ok ( node_modules_bin) ;
790+ for file in files {
791+ let node_modules_bin = current_dir. join ( "node_modules" ) . join ( ".bin" ) . join ( file) ;
792+ if node_modules_bin. exists ( ) {
793+ return Ok ( node_modules_bin) ;
794+ }
788795 }
789796
790797 // If we reach the root directory, stop searching
You can’t perform that action at this time.
0 commit comments