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

doesn't read stdin on Cygwin #32

Closed
VladimirAlexiev opened this issue Apr 3, 2018 · 8 comments
Closed

doesn't read stdin on Cygwin #32

VladimirAlexiev opened this issue Apr 3, 2018 · 8 comments

Comments

@VladimirAlexiev
Copy link

I got https://github.com/tomnomnom/gron/releases/download/v0.5.1/gron-windows-amd64-0.5.1.zip.

  • works ok from cmd (though need to specify -m to avoid the colors, or use a better terminal like conemu)
  • when I run from mintty & bash, doesn't read stdin:
$ gron http://jsonplaceholder.typicode.com/users/1
# works ok
$ curl -s http://jsonplaceholder.typicode.com/users/1 | gron -
# nothing happens
$ uname
CYGWIN_NT-6.1 
@tomnomnom
Copy link
Owner

Hi @VladimirAlexiev! Thanks for raising an issue :)

I'm afraid I don't own a Windows machine and I'm not massively familiar with cygwin so I might struggle to reproduce this.

Can you answer a few things for me?

  1. What shell is being used? Is it bash? sh?
  2. Does the curl command work by itself?
  3. Does echo '{"one":1}' | gron work?
  4. How about gron <(echo '{"one":1}')?

If that last one works then this might be a workaround for now:

▶ gron <(curl -s http://jsonplaceholder.typicode.com/users/1)
json = {};
json.address = {};
json.address.city = "Gwenborough";
json.address.geo = {};
...

A did a little bit of digging and found that cygwin and windows binaries can be a little odd, and that this might help: https://github.com/rprichard/winpty - but again I don't have a way to test it.

Sorry I can't be more help! If the winpty thing doesn't resolve the issue then I'll try my best to get a Windows VM up and running so I can debug things more easily.

@VladimirAlexiev
Copy link
Author

Hi @tomnomnom, thanks for looking into this!

  1. bash. I tried bash both in mintty and in cmd, the result is the same
  2. yes
  3. yes (and I didn't know one can skip - but that makes sense)
  4. No. I get this error: open /dev/fd/63: The system cannot find the path specified.

I read about winpty but can't figure out how it can help because I don't know what is pty-master. Says it helps Windows console apps with interactive input: but gron isn't interactive

Do you use STDIN in some unusual way? I got many cygwin programs that handle | just fine. Eg this works ok
curl -s http://jsonplaceholder.typicode.com/users/1 | less

Cheers!

@tomnomnom
Copy link
Owner

@VladimirAlexiev: no problem :)

I think the strangest thing here is that echo '{"one":1}' | gron works, but curl ... | gron does not!

Before we go any further, can you give this build a try and see if it works: gron-go1.10-build.zip?

It might be a little bit of a long-shot, but it's an easy one to test. I found an issue in the version of Go that was used to build the binary you're using that sounds as though it may be related, so I've built one with a newer version of Go.

Let me know if you have any luck with that, and if not I'll go and get myself a Windows VM :)

@joekyo
Copy link

joekyo commented Apr 4, 2018

This may be related to golang/go#22024
As I tested, when compile gron using go 1.9 and go 1.9.1, this issue can be reproduced.
You can download gron version 0.5.0 which compiled by go 1.8, or compile gron using go 1.9.2 or newer.

@tomnomnom
Copy link
Owner

Thanks @joekyo! The version I posted above was built with Go 1.10, which should work too in theory! If it does I'll cut a release built with 1.10 so the latest release works for everyone

@VladimirAlexiev
Copy link
Author

gron-go1.10-build.zip works fine. Thanks!!!

@tomnomnom
Copy link
Owner

@VladimirAlexiev fantastic! I'll cut a new release now so others don't hit the same issue :)

@tomnomnom
Copy link
Owner

I've released v0.5.2 built with Go 1.10; so all should be well with the world! Thanks again!

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

No branches or pull requests

3 participants