kislyuk / yq

Command-line YAML, XML, TOML processor - jq wrapper for YAML/XML/TOML documents
https://kislyuk.github.io/yq/
Apache License 2.0
2.62k stars 84 forks source link

Unable to use yq in a makefile, no tty #45

Closed alerque closed 5 years ago

alerque commented 5 years ago

Using yq in a makefile (run with GNU Make 4+) produces a fatal error. For some reason in that case sys.stdin does not have a isatty() function:

AttributeError: 'NoneType' object has no attribute 'isatty'
make[1]: *** [makefile:18: tt] Error 1
make[1]: Leaving directory '<path>'
make[1]: Entering directory '<path>'
Traceback (most recent call last):
  File "/usr/bin/yq", line 11, in <module>
    load_entry_point('yq==2.7.0', 'console_scripts', 'yq')()
  File "/usr/lib/python3.7/site-packages/yq/__init__.py", line 132, in main
    if sys.stdin.isatty() and not args.files:
AttributeError: 'NoneType' object has no attribute 'isatty'

The same command run from a shell works fine.

kislyuk commented 5 years ago

I am unable to reproduce this. Can you paste a Makefile that reproduces this, and the OS version?

alerque commented 5 years ago

I am unable to reproduce this either. I put together a 2 line Makefile to prove it to my self before filing this issue and it was so cut and dry that it worked in a shell but not from a Makefile that I didn't bother saving the test case. Now I can't reproduce it either. I know I was using 2.7.0 at the time and discovered 2.7.1 the next day, and now I don't have this problem. Either it got fixed or something else was wrong with my system.