Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nfischer opened this issue Jan 15, 2022 · 0 comments
Open

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

nfischer opened this issue Jan 15, 2022 · 0 comments
Labels
bash compat Compatibility issues with bash or POSIX behavior breaking Breaking change fix Bug/defect, or a fix for such a problem

Comments

@nfischer
Copy link
Member

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

@nfischer nfischer added bash compat Compatibility issues with bash or POSIX behavior breaking Breaking change fix Bug/defect, or a fix for such a problem labels Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bash compat Compatibility issues with bash or POSIX behavior breaking Breaking change fix Bug/defect, or a fix for such a problem
Projects
None yet
Development

No branches or pull requests

1 participant