diff --git a/src/modules/nodejs.rs b/src/modules/nodejs.rs index f9088f52..9f3dcfc8 100644 --- a/src/modules/nodejs.rs +++ b/src/modules/nodejs.rs @@ -30,6 +30,7 @@ pub fn module<'a>(context: &'a Context) -> Option> { let mut module = context.new_module("nodejs"); let config = NodejsConfig::try_load(module.config); + let nodejs_version = utils::exec_cmd("node", &["--version"])?.stdout; let parsed = StringFormatter::new(config.format).and_then(|formatter| { formatter .map_meta(|var, _| match var { @@ -41,7 +42,7 @@ pub fn module<'a>(context: &'a Context) -> Option> { _ => None, }) .map(|variable| match variable { - "version" => Some(Ok(utils::exec_cmd("node", &["--version"])?.stdout)), + "version" => Some(Ok(nodejs_version.trim())), _ => None, }) .parse(None)