Commit a5cca6de authored by Aron Griffis's avatar Aron Griffis

Use a sed() function for unbuffered output.

In `bin/steps/collectstatic` the unbuffered output in `indent` is subverted
by calling `sed` first:

```shell
python $MANAGE_FILE collectstatic --noinput  2>&1 | sed '/^Copying/d;/^$/d;/^ /d' | indent
```

This commit fixes this by making `sed` itself unbuffered rather than
putting that logic in the `indent` function.
parent 566f7f45
#!/usr/bin/env bash #!/usr/bin/env bash
# Syntax sugar. source $BIN_DIR/utils
indent() {
RE="s/^/ /"
[ $(uname) == "Darwin" ] && sed -l "$RE" || sed -u "$RE"
}
MANAGE_FILE=$(find . -maxdepth 3 -type f -name 'manage.py' | head -1) MANAGE_FILE=$(find . -maxdepth 3 -type f -name 'manage.py' | head -1)
MANAGE_FILE=${MANAGE_FILE:-fakepath} MANAGE_FILE=${MANAGE_FILE:-fakepath}
......
shopt -s extglob shopt -s extglob
[ $(uname) == "Darwin" ] && SED_FLAG='-l' || SED_FLAG='-u' if [ $(uname) == Darwin ]; then
sed() { command sed -l "$@"; }
else
sed() { command sed -u "$@"; }
fi
# Syntax sugar. # Syntax sugar.
indent() { indent() {
RE="s/^/ /" sed "s/^/ /"
sed $SED_FLAG "$RE"
} }
# Clean up pip output # Clean up pip output
cleanup() { cleanup() {
sed $SED_FLAG -e 's/\.\.\.\+/.../g' | sed $SED_FLAG '/already satisfied/Id' | sed $SED_FLAG -e '/Overwriting/Id' | sed $SED_FLAG -e '/python executable/Id' | sed $SED_FLAG -e '/no previously-included files/Id' sed -e 's/\.\.\.\+/.../g' | sed -e '/already satisfied/Id' | sed -e '/Overwriting/Id' | sed -e '/python executable/Id' | sed -e '/no previously-included files/Id'
} }
# Buildpack Steps. # Buildpack Steps.
...@@ -77,4 +80,4 @@ sub-env() { ...@@ -77,4 +80,4 @@ sub-env() {
$1 $1
) )
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment