Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for windows users with space in tsc path #62

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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