Skip to content

Unexpected double newline in shell.sed() output #1068

Description

@nfischer

Node version (or tell us if you're using electron or some other framework):

All?

ShellJS version (the most recent version/Github branch you see the bug on):

tip-of-tree (GitHub main branch)

Operating system:

All?

Description of the bug:

I think there's a double-newline in sed() outupt there shouldn't be:

shelljs/test/sed.js

Lines 170 to 173 in 1a8e38d

const result = shell.sed('-i', 'test', 'hello', `${t.context.tmp}/file*.txt`);
t.falsy(shell.error());
t.is(result.code, 0);
t.is(result.toString(), 'hello1\n\nhello2\n'); // TODO: fix sed's behavior

Need to investigate more and figure out what's going on here.

Example ShellJS command to reproduce the error:

The \n\n between "hello1" and "hello2" should probably only be a single \n.

shelljs/test/sed.js

Lines 170 to 173 in 1a8e38d

const result = shell.sed('-i', 'test', 'hello', `${t.context.tmp}/file*.txt`);
t.falsy(shell.error());
t.is(result.code, 0);
t.is(result.toString(), 'hello1\n\nhello2\n'); // TODO: fix sed's behavior

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bash compatCompatibility issues with bash or POSIX behaviorbreakingBreaking changefixBug/defect, or a fix for such a problem

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions