zquestz / s

Open a web search in your terminal.
MIT License
2.35k stars 114 forks source link

Install instructions on Windows (8.1) #74

Closed rubenhazelaar closed 8 years ago

rubenhazelaar commented 8 years ago

I have some trouble installing on Windows (no make tools, newest I can find are from 2006). So I tried the built s.exe, however I get the following error:

[Error] Failed to stat Stdin: GetFileInformationByHandle /dev/stdin: Incorrect function.

Could you provide install instruction for Windows? Perhaps something to add to the README.md?

zquestz commented 8 years ago

There should be no custom make tools required. All you need is a working golang install. Docs are available at: https://golang.org/doc/install

pborzenkov commented 8 years ago

The problem is that Stat() doesn't work for stdin on Windows. GetFileInformationByHandle() WinAPI function fails when being called with stdin argument. Here is the Stat() code: https://golang.org/src/os/stat_windows.go

As a possible solution, goos and error might be checked: goos == Windows and err != nil -> not a pipe, goos == Window and err == nil -> pipe:

rubenhazelaar commented 8 years ago

Just to provide some more information. I'm running Go v1.5.2. The executable installed correctly and I can execute s puppies, however I get the previously stated error ([Error] Failed to stat Stdin: GetFileInformationByHandle /dev/stdin: Incorrect function.)

zquestz commented 8 years ago

Give it a shot now. I think the issue is that you were using cmd.exe and not a real shell like bash/zsh through cygwin. I have put up a fix that should address your error. =)

rubenhazelaar commented 8 years ago

Great, will try it ASAP. But should I use something like cygwin, can I use cmd.exe or Powershell now also? I used Powershell btw :)

zquestz commented 8 years ago

Awesome! Let me know if it works! All of them should work fine now, just won't support piping in the query from another command if Stdin isn't available.

zquestz commented 8 years ago

Any luck?

rubenhazelaar commented 8 years ago

Works like a charm! Great!