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

wrangler init throws an error if git is not available #1022

Closed
shehiramkamal opened this issue May 16, 2022 · 2 comments · Fixed by #1033 or #1025
Closed

wrangler init throws an error if git is not available #1022

shehiramkamal opened this issue May 16, 2022 · 2 comments · Fixed by #1033 or #1025
Assignees
Labels
bug Something that isn't working

Comments

@shehiramkamal
Copy link

while using this command, i get this error

npx wrangler init my-worker
⛅️ wrangler 2.0.5

Using npm as package manager.
✨ Created my-worker\wrangler.toml

X [ERROR] Command failed with exit code 1: git --version

'git' is not recognized as an internal or external command,
operable program or batch file.

@petebacondarwin
Copy link
Contributor

Hmm, strange. That should have been fixed by 1caa5f7

@petebacondarwin petebacondarwin added the bug Something that isn't working label May 16, 2022
@petebacondarwin petebacondarwin moved this to Untriaged in workers-sdk May 16, 2022
@petebacondarwin petebacondarwin moved this from Untriaged to Selected for development in workers-sdk May 16, 2022
@petebacondarwin
Copy link
Contributor

petebacondarwin commented May 16, 2022

I think that the fix expects the process not to throw an exception but just return a non-zero exitCode or, if it does throw, for the error to be of type ENOENT.

Perhaps on Windows the behaviour is different?

@petebacondarwin petebacondarwin self-assigned this May 16, 2022
@threepointone threepointone changed the title error wrangler init throws an error if git is not available May 16, 2022
petebacondarwin added a commit to petebacondarwin/wrangler2 that referenced this issue May 16, 2022
We check for the presence of Git by trying to run `git --version`.
On non-Windows we get an Error with `code` set to "ENOENT".
One Windows we get a different error:

```
{
  "shortMessage":"Command failed with exit code 1: git --version",
  "command":"git --version",
  "escapedCommand":"git --version",
  "exitCode":1,
  "stdout":"",
  "stderr":"'git' is not recognized as an internal or external command,\r\noperable program or batch file.",
  "failed":true,
  "timedOut":false,
  "isCanceled":false,
  "killed":false
}
```

Since we don't really care what the error is, now we just assume that Git
is not available if an error is thrown.

Fixes cloudflare#1022
@petebacondarwin petebacondarwin moved this from Selected for development to In Progress in workers-sdk May 16, 2022
@petebacondarwin petebacondarwin moved this from In Progress to In Review in workers-sdk May 16, 2022
petebacondarwin added a commit that referenced this issue May 16, 2022
…ows (#1033)

We check for the presence of Git by trying to run `git --version`.
On non-Windows we get an Error with `code` set to "ENOENT".
One Windows we get a different error:

```
{
  "shortMessage":"Command failed with exit code 1: git --version",
  "command":"git --version",
  "escapedCommand":"git --version",
  "exitCode":1,
  "stdout":"",
  "stderr":"'git' is not recognized as an internal or external command,\r\noperable program or batch file.",
  "failed":true,
  "timedOut":false,
  "isCanceled":false,
  "killed":false
}
```

Since we don't really care what the error is, now we just assume that Git
is not available if an error is thrown.

Fixes #1022
Repository owner moved this from In Review to Done in workers-sdk May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working
Projects
None yet
2 participants