-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix wait.sh/copy.sh quoting for exec'd/wrapped cmd. #22
Conversation
Quoting melts my brain for some reason (also in mal...). I'm working out this failing scenario:
Changing
|
Using the original |
Yeah, |
Add "Running" comment to copy.sh to match wait.sh. Fix minor formating issue in copy.sh.
Yeah, that's what I was afraid of. I did a bit more debug work and figured out why This breaks:
This also breaks:
This however works:
Apparently the previous two versions are preserving the newlines as part of the arguments themselves although curiously, it looks like it's preserving them as whitespace (or some character that's not a newline). So using unquoted |
@kanaka I spent an hour reading the YAML spec (on an exercise bike so would have been watching YouTube anyway) so you don't have to, and to be honest am not that more enlightened, except to know that the backslash is never a line continuation in YAML. Backslashes are only used as a special character in double-quoted style flow scalars to escape a fixed number of single characters, e.g I suspect all of the odd behaviour is ultimately bash's fault - prove me wrong! (: Here's my YAML scalar cheat sheet:
Surprisingly, plain-style block scalars turn out to contain the least amount of bonus whitespace. You are almost compelled to use a backslash line continuation due to muscle memory. if you start the value on the same line as the key. It turns out that these two YAML documents are equivalent, but the second doesn't instantly look like it would be a scalar, at least to my eyes.
and both produce the JSON
It appears impossible to be rid of the trailing newline for literal and folded block scalars, unless it appears at the end of the file and the file has no trailing newline (which is actually a violation of the POSIX definition of a line). |
Add "Running" comment to copy.sh to mirror wait.sh. Fix minor formating issue in copy.sh.