-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a huge ugly hack for golden tests.
- Loading branch information
1 parent
6dbecf1
commit 5618b18
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ pkgs ? import <nixpkgs> {} }: | ||
|
||
let | ||
patched-yq = import ./yq.nix { inherit pkgs; }; | ||
in | ||
pkgs.mkShell { | ||
buildInputs = with pkgs; [ pkg-config patched-yq zlib ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ pkgs ? import <nixpkgs> {} }: | ||
|
||
# Make yq work inside whatever `stack test` launches. | ||
|
||
let | ||
yq-patch = pkgs.writeText "yq-tty-fix.patch" '' | ||
diff --git a/yq/__init__.py b/yq/__init__.py | ||
index d95ac4b..ae7d59e 100644 | ||
--- a/yq/__init__.py | ||
+++ b/yq/__init__.py | ||
@@ -110,7 +110,7 @@ def cli(args=None, input_format="yaml", program_name="yq"): | ||
in_place = args.in_place | ||
delattr(args, "in_place") | ||
- if sys.stdin.isatty() and not args.input_streams: | ||
+ if (sys.stdin is None or sys.stdin.isatty()) and not args.input_streams: | ||
parser.print_help() | ||
sys.exit(2) | ||
elif not args.input_streams: | ||
''; | ||
in | ||
pkgs.yq.overrideAttrs (final: old: { | ||
patches = old.patches ++ [ yq-patch ]; | ||
}) |