Skip to content

Commit 8276be4

Browse files
committed
build-splunkrc.py distinguishes between tty and pipe
1 parent 38c8649 commit 8276be4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

scripts/build-splunkrc.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def parse_hostport(host_port):
8585
def run(variable, splunkrc_path=None):
8686
# read JSON from input
8787
# parse the JSON
88-
input_config = build_config(variable)
88+
input_config = build_config(variable) if variable else DEFAULT_CONFIG
8989

9090
config = {**DEFAULT_CONFIG, **input_config}
9191

@@ -104,5 +104,9 @@ def run(variable, splunkrc_path=None):
104104
with open(splunkrc_path, 'w') as f:
105105
f.write(splunkrc_string)
106106

107-
DATA = sys.stdin.read()
107+
if sys.stdin.isatty():
108+
DATA = None
109+
else:
110+
DATA = sys.stdin.read()
111+
108112
run(DATA, sys.argv[1] if len(sys.argv) > 1 else None)

0 commit comments

Comments
 (0)