Try to fix the output from OutputTo-JSON in powershell commands to make it valid JSON
(text)
| 4806 | |
| 4807 | |
| 4808 | def _prep_powershell_json(text): |
| 4809 | """ |
| 4810 | Try to fix the output from OutputTo-JSON in powershell commands to make it |
| 4811 | valid JSON |
| 4812 | """ |
| 4813 | # An empty string just needs to be an empty quote |
| 4814 | if text == "": |
| 4815 | text = '""' |
| 4816 | else: |
| 4817 | # Raw text needs to be quoted |
| 4818 | starts_with = ['"', "{", "["] |
| 4819 | if not any(text.startswith(x) for x in starts_with): |
| 4820 | text = f'"{text}"' |
| 4821 | return text |
| 4822 | |
| 4823 | |
| 4824 | def run_bg( |
no outgoing calls
no test coverage detected