diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-07 17:28:36 +0100 |
|---|---|---|
| committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-07 17:28:36 +0100 |
| commit | 18dedf3463534a9f6c8137628c482298dbb0459b (patch) | |
| tree | 4aa925c3ad0b584d34a3c0e775e895b4f5a31824 | |
| parent | 5ad1c0e821a5aaafe47dbe79d5f69820fde798bd (diff) | |
| download | monitoring-plugins-18dedf3463534a9f6c8137628c482298dbb0459b.tar.gz | |
Do not die in tests if JSON Parsing fails
| -rw-r--r-- | NPTest.pm | 6 |
1 files changed, 5 insertions, 1 deletions
| @@ -17,6 +17,8 @@ use File::Basename; | |||
| 17 | 17 | ||
| 18 | use JSON; | 18 | use JSON; |
| 19 | 19 | ||
| 20 | use feature 'try'; | ||
| 21 | |||
| 20 | use IO::File; | 22 | use IO::File; |
| 21 | use Data::Dumper; | 23 | use Data::Dumper; |
| 22 | 24 | ||
| @@ -619,7 +621,9 @@ sub testCmd { | |||
| 619 | chomp $output; | 621 | chomp $output; |
| 620 | $object->output($output); | 622 | $object->output($output); |
| 621 | 623 | ||
| 622 | $object->{'mp_test_result'} = decode_json($output); | 624 | try { |
| 625 | $object->{'mp_test_result'} = decode_json($output); | ||
| 626 | } | ||
| 623 | 627 | ||
| 624 | alarm(0); | 628 | alarm(0); |
| 625 | 629 | ||
