git.iko.soy/typeable/compaREST
on master help sign in
26 lines 809 B history raw
1{ pkgs ? import <nixpkgs> {} }:
3# Make yq work inside whatever `stack test` launches.
4# Nuke this when https://github.com/kislyuk/yq/pull/193 is merged
5# and nixpkgs includes that fix.
7let
8 yq-patch = pkgs.writeText "yq-tty-fix.patch" ''
9diff --git a/yq/__init__.py b/yq/__init__.py
10index d95ac4b..ae7d59e 100644
11--- a/yq/__init__.py
12+++ b/yq/__init__.py
13@@ -110,7 +110,7 @@ def cli(args=None, input_format="yaml", program_name="yq"):
14 in_place = args.in_place
15 delattr(args, "in_place")
17- if sys.stdin.isatty() and not args.input_streams:
18+ if (sys.stdin is None or sys.stdin.isatty()) and not args.input_streams:
19 parser.print_help()
20 sys.exit(2)
21 elif not args.input_streams:
22 '';
23in
24pkgs.yq.overrideAttrs (final: old: {
25 patches = old.patches ++ [ yq-patch ];
26})