You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
echo -e 'let a = 3;\nprintln!("{}", a + 2);' > mwe.rs
If I run
runner --prepend "// pre\n" mwe.rs
then I get an error. I think that's because there is no newline after the prefix, which means the first line gets swallowed by a comment. It seems Bash likes swallowing trailing whitespace.
24 | println!("{}", a + 2);
| ^ not found in this scope
Maybe either or both of these solutions could be applied:
Put a newline after the prepended text by default (easy and avoids mistakes, but doesn't allow newlines in the prepend text).
Replace any "\n" by a real newline. Convenient for adding any newline anywhere despite shell escaping.
The text was updated successfully, but these errors were encountered:
I've used Bash for twenty years and still think it's a bastard. In my current work I've been converting the string "\n" into the char '\n' but, again, there's going to be surprises with actual quoted strings with the second approach. It's probably the best, with documented limitations. I like the first as well, since not wanting that linefeed would be pretty rare!
I'm having a bit of trouble with
--prepend
:If I run
then I get an error. I think that's because there is no newline after the prefix, which means the first line gets swallowed by a comment. It seems Bash likes swallowing trailing whitespace.
Maybe either or both of these solutions could be applied:
The text was updated successfully, but these errors were encountered: