Skip to content

Multiple consecutive newlines in heredoc are converted to one #644

@m-iwanicki

Description

@m-iwanicki

Bashly Version

Latest Docker Image

Description

Creating heredoc with multiple consecutive newlines (e.g. simulating multiple Enter/default choices) results in those newlines being trimmed to only one newline. This results in possibly hard to debug bugs.

Contents of bashly.yml

Reproduction Steps

bashly init --minimal
cat <<EOT >src/root_command.sh
fdisk "/dev/sdc" <<EOF
n
p
3


w
EOF
EOT
bashly generate

Compare contents of generated download script with src/root_command.sh

Actual Behavior

Only one newline instead of 2.

grep 'fdisk "/dev/sdc" <<EOF' download -B2 -A7

Output:

root_command() {
  # src/root_command.sh
  fdisk "/dev/sdc" <<EOF
n
p
3

w
EOF

Which results in hard to debug failure

Expected Behavior

The same amount of newlines as in script

grep 'fdisk "/dev/sdc" <<EOF' download -B2 -A7

Output:

root_command() {
  # src/root_command.sh
  fdisk "/dev/sdc" <<EOF
n
p
3


w
EOF

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions