Skip to content

Conversation

foohines
Copy link
Contributor

This fixes the issue #60 which occurs when:

  • The user is using windows
  • The path to the user's tsc.cmd includes a space e.g
    C:\Users\foohines\code\dir with space\node_modules\.bin\tsc.cmd

This fix works by:

  • Wrapping the tscPath in double quotes if it contains a space (passed as spawnSync's first argument)
  • Wrapping the projectArg in double quotes if it contains a space (passed in spawnSync's second argument)
  • Setting { shell: true } option to spawnSync for windows users only

More context can be found in the node documentation on how to correctly spawn windows .cmd files

@jonasgeiler
Copy link

jonasgeiler commented Oct 22, 2023

Shouldn't setting shell to true be enough? I tried fixing it in my fork: https://github.com/skayo/tsc-files
Will see if I open a PR, but for now I'll publish my fork as it's own package (@jonasgeiler/tsc-files)

@foohines
Copy link
Contributor Author

I don't think so. I tested your fork and my own with just shell: true, and when a windows user has a space in their tsc path, it still fails with the same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants