Skip to content

Shell flags inherited by child shells #50

@CyberShadow

Description

@CyberShadow

Consider these scripts:

cat > child.sh <<'EOF'
#!/bin/bash
echo $unset
echo "Survived!"
EOF

cat > parent.sh <<'EOF'
#!/bin/bash
set -eu
./child.sh
EOF

chmod +x parent.sh child.sh

The behavior is different depending on whether the script is run under bashcov or not:

$ ./parent.sh          

Survived!

$ bashcov ./parent.sh
./child.sh: line 3: unset: unbound variable
Run completed using bashcov 1.8.2 with Bash 5.0, Ruby 2.6.2, and SimpleCov 0.15.1.
Coverage report generated for /bin/bash ./parent.sh to /home/vladimir/tmp/2019-04-04-scratch/04:43:13/coverage. 2 / 4 LOC (50.0%) covered.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions