From c182572796d4388498059f7b0c104ec613b87f7d Mon Sep 17 00:00:00 2001 From: Thomas O'Donnell Date: Sat, 13 Jun 2020 01:04:53 +0200 Subject: [PATCH] Fix PHP version including error messages (#1317) PHP will output error messages when displaying the version if, for example, there is something wrong with the local `php.ini` file. Have updated the command used to get the PHP version to only use the default PHP config. --- src/modules/php.rs | 2 +- src/utils.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/php.rs b/src/modules/php.rs index 4cf0b98c..167f2ffd 100644 --- a/src/modules/php.rs +++ b/src/modules/php.rs @@ -22,7 +22,7 @@ pub fn module<'a>(context: &'a Context) -> Option> { match utils::exec_cmd( "php", &[ - "-r", + "-nr", "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION.'.'.PHP_RELEASE_VERSION;", ], ) { diff --git a/src/utils.rs b/src/utils.rs index 7687a300..7f7e7f4d 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -87,7 +87,7 @@ active boot switches: -d:release\n", stdout: String::from("4.10.0"), stderr: String::default(), }), - "php -r echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION.'.'.PHP_RELEASE_VERSION;" => { + "php -nr echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION.'.'.PHP_RELEASE_VERSION;" => { Some(CommandOutput { stdout: String::from("7.3.8"), stderr: String::default(),