Skip to content

fix(sed): avoid extra newline when joining multiple files - #1261

Open
Hashim1999164 wants to merge 1 commit into
shelljs:mainfrom
Hashim1999164:fix/sed-multi-file-double-newline
Open

fix(sed): avoid extra newline when joining multiple files#1261
Hashim1999164 wants to merge 1 commit into
shelljs:mainfrom
Hashim1999164:fix/sed-multi-file-double-newline

Conversation

@Hashim1999164

@Hashim1999164 Hashim1999164 commented Jul 22, 2026

Copy link
Copy Markdown

Summary

  • sed was joining multi-file results with an extra newline, so files that already ended with \n produced a blank line between them (hello1\n\nhello2\n).
  • Join file outputs directly, matching unix sed/cat concatenation.
  • Update multi-file tests and add a regression covering trailing-newline inputs.

Fixes #1068

Test plan

  • npx ava test/sed.js
  • Manual check: sed on file1.txt + file2.txt yields hello1\nhello2\n (not a double newline)

Concatenating sed results with an extra newline inserted a blank line
between files that already ended with a newline. Match unix sed/cat by
joining file outputs directly.

Fixes shelljs#1068.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected double newline in shell.sed() output

1 participant