con2 / emrichen

A Template engine for YAML & JSON
MIT License
107 stars 11 forks source link

Don't seek or truncate pipes, that's silly! #58

Closed akx closed 2 years ago

akx commented 2 years ago

Fixes #57

japsu commented 2 years ago

@akx this feels sorta hairy.

the original problem was that emrichen truncated --output-file on startup, making one unable to !Include the same file for in-place update

what if, instead of .seek(0) and suppress(OSError) hackery, we would pass the output file by name and only open it at the end of the process when we are ready to write out the enriched result?

akx commented 2 years ago

@japsu Sure. Reimplemented!