-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to a new output helper for error messages (#1639)
The existing logging functions in `bin/utils` don't support being passed multi-line output. Upcoming PRs are going to be adding a number of new error messages, so this adds a new output module under `lib/` (that supports multi-line output and also uses colour) and switches the existing buildpack error messages to it. Now that the buildpack error messages use ANSI colour codes, the Hatchet output has to have ANSI sequences stripped prior to the output assertions. GUS-W-16808943.
- Loading branch information
Showing
12 changed files
with
117 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
ANSI_RED='\033[1;31m' | ||
ANSI_RESET='\033[0m' | ||
|
||
# shellcheck disable=SC2120 # Prevent warnings about unused arguments due to the split args vs stdin API. | ||
function display_error() { | ||
# Send all output to stderr | ||
exec 1>&2 | ||
# If arguments are given, redirect them to stdin. This allows the function | ||
# to be invoked with either a string argument or stdin (e.g. via <<-EOF). | ||
(($#)) && exec <<<"${@}" | ||
echo | ||
while IFS= read -r line; do | ||
echo -e "${ANSI_RED} ! ${line}${ANSI_RESET}" | ||
done | ||
echo | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.