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

Avoid using sed -i in makedoc.g #234

Open
fingolfin opened this issue Oct 19, 2022 · 0 comments
Open

Avoid using sed -i in makedoc.g #234

fingolfin opened this issue Oct 19, 2022 · 0 comments

Comments

@fingolfin
Copy link
Member

... as it is not portable between GNU sed and BSD sed (as used on e.g. macOS).
Possible alternatives:

  • avoid it altogether: in the first usecase it is used to remove leading whitespace form a file we just generated. Instead of that, simplify modify the string cont suitably before printing it out (e.g. search for the substrings of the form \n or \n\t or \n\t and replace them by \n: Say via cont := JoinStringsWithSeparator(List(SplitString(cont,"\n"), line -> StripBeginEnd(line, " \t")), "\n"); -- this would also remove trailing whitespace, which I think is desirable here
  • use perl -pi -e EXPR (but then you need perl, which is a much heavier dependency than sed)
  • instead of using -i to enable in-place editing, just pipe the output of sed into a separate file
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

No branches or pull requests

1 participant