You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Only read stdin when no files are given, or when a flag asks for it #736
RexReplace reads stdin every time stdin is not a terminal, also when files are given. It waits for stdin to close before it starts.
Some environments (CI runners, agent harnesses, cron, docker exec) give the process a pipe that is open, but never written to and never closed. Then RexReplace hangs:
grep, sed, awk and jq do not hang, as they only read stdin when no file is given.
Change
Only read stdin when it is asked for:
When
The piped data is
No files are given
The content
--replacement-pipe (-R)
The replacement
--pipe (-p)
Given to the JavaScript in pipe
In all other cases stdin is not touched, so the run starts at once.
Add --pipe (-p): read the piped data and make it available to the JavaScript of --replacement-js as pipe. The warning that piped data is not used stays.
Add --js-pipe as a shorthand for --replacement-js --pipe (-jp).
Remove -P, --void-pipe and RR_VOID_PIPE.
Remove the note about the hang from the README.
> rexreplace foo bar '*.md'# stdin is not read> cat names.txt | rexreplace foo bar '*.md' -R # replacement from stdin> cat list.txt | rexreplace x 'pipe''*.md' --js-pipe # code gets the piped data
Good to know
-P and RR_VOID_PIPE were never released (npm has v7.1.14), so removing them breaks nothing.
No timeout: a slow writer and a writer that never writes look the same until the pipe closes.
changed the title [-]Only read stdin when no files are given or with --replacement-pipe[/-][+]Only read stdin when no files are given, or when a flag asks for it[/+]on Oct 21, 2026
Activity
[-]Only read stdin when no files are given or with --replacement-pipe[/-][+]Only read stdin when no files are given, or when a flag asks for it[/+]