geofffranks / spruce

A BOSH template merge tool
MIT License
427 stars 77 forks source link

reading from stdin fails if `-` is explicitly given #311

Closed thomasmitchell closed 4 years ago

thomasmitchell commented 4 years ago

It is attempting to parse STDIN twice. STDIN is empty the second time, however, so it errs early.

 ~/go_workspace/src/github.com/geofffranks/spruce → echo '{"foo": "bar"}' | spruce -DT merge -
DEBUG> Processing file '-'
DEBUG> $.foo: not found upstream, adding it
DEBUG> $.foo: replacing with new data (new data is neither map nor array)
-----> Current data after processing 'STDIN':
-----> foo: bar
----->
DEBUG> Processing file '-'
Error reading STDIN: no data found. Did you forget to pipe data to STDIN, or specify yaml files to merge?

Funnily enough, it looks like this was introduced in the fix to #306 , where we got no STDIN. Now we get two.