From 22141d4f44e3208804cc6a89e611a363a9a97528 Mon Sep 17 00:00:00 2001 From: Buckram Date: Fri, 8 Mar 2024 10:50:36 +0200 Subject: [PATCH] Use lossy string, instead of panicking on non-utf8 --- packages/test-tube/src/runner/result.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/test-tube/src/runner/result.rs b/packages/test-tube/src/runner/result.rs index f9543530..ebef1acd 100644 --- a/packages/test-tube/src/runner/result.rs +++ b/packages/test-tube/src/runner/result.rs @@ -216,11 +216,7 @@ impl RawResult { if code == 0 { Some(Self(Ok(content.to_vec()))) } else { - let content_string = CString::new(content) - .unwrap() - .to_str() - .expect("Go code must encode valid UTF-8 string") - .to_string(); + let content_string = CString::new(content).unwrap().to_string_lossy().to_string(); let error = match code { 1 => RunnerError::QueryError {