Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ function handlePipedData(config) {
!config.replacementJs &&
!config.pipedDataUsed &&
config.pipedData &&
'\n' !== config.pipedData
'\n' !== config.pipedData &&
'\r\n' !== config.pipedData
) {
warn('Data is piped in, but no flag tells what to do with it. It is not used.');
}
Expand Down
3 changes: 3 additions & 0 deletions test/cli/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@ assert_failure "printf x | rexreplace 'o' 'x' my.file -q 2>&1 | grep 'Data is p
assert_failure "printf x | rexreplace 'o' 'x' my.file -P 2>&1 | grep 'Data is piped in'"
assert_failure "printf x | rexreplace 'b' _ my.file -R 2>&1 | grep 'Data is piped in'"
assert_failure "printf x | rexreplace 'b' 'pipe' my.file -j 2>&1 | grep 'Data is piped in'"
assert_failure "printf '' | rexreplace 'o' 'x' my.file 2>&1 | grep 'Data is piped in'"
assert_failure "printf '\n' | rexreplace 'o' 'x' my.file 2>&1 | grep 'Data is piped in'"
assert_failure "printf '\r\n' | rexreplace 'o' 'x' my.file 2>&1 | grep 'Data is piped in'"


# RR_VOID_PIPE
Expand Down
2 changes: 1 addition & 1 deletion test/js/fix/719.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('#719 a warning when piped data is not used', () => {
expect(await Bun.file('my.file').text()).toBe('fooxar');
});

test.each([null, '', '\n'])('is not given when %j is piped in', async (pipedData) => {
test.each([null, '', '\n', '\r\n'])('is not given when %j is piped in', async (pipedData) => {
expect((await piped({pipedData})).err).toBe('my.file \n');
});

Expand Down
Loading