Skip to content

Commit

Permalink
Strip control characters from return JSON on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleKotowick committed Jul 30, 2021
1 parent 6a605aa commit 6a07602
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Creative Commons Attribution 4.0 International
### Copyright (c) 2021 [Invicton Labs](https://invictonlabs.com)

Copyright (c) 2021 Invicton Labs (https://invictonlabs.com)
# Creative Commons Attribution 4.0 International

Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.

Expand Down
4 changes: 2 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if [ "$_exitonfail" = "true" ] && [ $_exitcode -ne 0 ] ; then
fi

# Replace characters that can't be handled in JSON
_stderr=$(echo "$_stderr" | sed -z 's/\n/__TF_MAGIC_NEWLINE_STRING/g;s/\r/__TF_MAGIC_CR_STRING/g;s/\t/__TF_MAGIC_TAB_STRING/g;s/\\/__TF_MAGIC_BACKSLASH_STRING/g;s/\"/__TF_MAGIC_QUOTE_STRING/g')
_stdout=$(echo "$_stdout" | sed -z 's/\n/__TF_MAGIC_NEWLINE_STRING/g;s/\r/__TF_MAGIC_CR_STRING/g;s/\t/__TF_MAGIC_TAB_STRING/g;s/\\/__TF_MAGIC_BACKSLASH_STRING/g;s/\"/__TF_MAGIC_QUOTE_STRING/g')
_stderr=$(echo "$_stderr" | tr -d '\000-\010\013\014\016-\037' | sed -z 's/\n/__TF_MAGIC_NEWLINE_STRING/g;s/\r/__TF_MAGIC_CR_STRING/g;s/\t/__TF_MAGIC_TAB_STRING/g;s/\\/__TF_MAGIC_BACKSLASH_STRING/g;s/\"/__TF_MAGIC_QUOTE_STRING/g')
_stdout=$(echo "$_stdout" | tr -d '\000-\010\013\014\016-\037' | sed -z 's/\n/__TF_MAGIC_NEWLINE_STRING/g;s/\r/__TF_MAGIC_CR_STRING/g;s/\t/__TF_MAGIC_TAB_STRING/g;s/\\/__TF_MAGIC_BACKSLASH_STRING/g;s/\"/__TF_MAGIC_QUOTE_STRING/g')

echo -n "{\"stderr\": \"$_stderr\", \"stdout\": \"$_stdout\", \"exitcode\": \"$_exitcode\"}"

0 comments on commit 6a07602

Please # to comment.