From 15bc9fa210095789245892dd07a053c21247186e Mon Sep 17 00:00:00 2001 From: Thomas O'Donnell Date: Wed, 15 Jul 2020 23:22:40 +0200 Subject: [PATCH] fix(ocaml): Stop new line being included in ocaml version (#1479) This fixes a regression in the ocaml module that caused the excess whitespace to not be trimmed from the version. --- src/modules/ocaml.rs | 2 +- src/utils.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/ocaml.rs b/src/modules/ocaml.rs index 3b753a92..6b827332 100644 --- a/src/modules/ocaml.rs +++ b/src/modules/ocaml.rs @@ -50,7 +50,7 @@ pub fn module<'a>(context: &'a Context) -> Option> { _ => None, }) .map(|variable| match variable { - "version" => Some(Ok(format!("v{}", &ocaml_version))), + "version" => Some(Ok(format!("v{}", &ocaml_version.trim()))), _ => None, }) .parse(None) diff --git a/src/utils.rs b/src/utils.rs index 2ef3cef5..945c6088 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -84,11 +84,11 @@ active boot switches: -d:release\n", stderr: String::default(), }), "ocaml -vnum" => Some(CommandOutput { - stdout: String::from("4.10.0"), + stdout: String::from("4.10.0\n"), stderr: String::default(), }), "esy ocaml -vnum" => Some(CommandOutput { - stdout: String::from("4.08.1"), + stdout: String::from("4.08.1\n"), stderr: String::default(), }), "php -nr echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION.'.'.PHP_RELEASE_VERSION;" => {