From 1c0203913ddbd2379831a9e2d9cbd374879c895e Mon Sep 17 00:00:00 2001 From: Eaton Zveare Date: Wed, 20 Apr 2022 00:26:33 -0400 Subject: [PATCH 1/2] Improve version checking --- src/wranglerjs/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wranglerjs/mod.rs b/src/wranglerjs/mod.rs index f6e9d3cb9..6046d3759 100644 --- a/src/wranglerjs/mod.rs +++ b/src/wranglerjs/mod.rs @@ -315,11 +315,11 @@ fn random_chars(n: usize) -> String { .collect() } -// If user is on Node 17, we may need legacy OpenSSL because Webpack 4 relies on +// If user is on Node 17+, we may need legacy OpenSSL because Webpack 4 relies on // calls that were removed in OpenSSL 3. See: // https://github.com/cloudflare/wrangler/issues/2108 // https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V17.md#openssl-30 -// Node 17 can still be built against OpenSSL 1, in which case the option +// Node 17+ can still be built against OpenSSL 1, in which case the option // doesn't exist. We need to check for that as well. See: // https://github.com/cloudflare/wrangler/issues/2155 fn use_legacy_openssl_if_necessary(command: &mut Command) -> Result<()> { @@ -328,7 +328,7 @@ fn use_legacy_openssl_if_necessary(command: &mut Command) -> Result<()> { let mut version_check_command = Command::new(&node); version_check_command.arg("--version"); let result = version_check_command.output()?.stdout; - let need_legacy_openssl = String::from_utf8_lossy(&result).contains("v17"); + let need_legacy_openssl = String::from_utf8_lossy(&result)[1..3].parse::().unwrap() >= 17; let mut option_exists_command = Command::new(&node); option_exists_command.arg("--help"); From 0d2b6248de0fe22b7826c97d66cf334d050047b2 Mon Sep 17 00:00:00 2001 From: Sunil Pai Date: Thu, 21 Apr 2022 10:27:40 +0100 Subject: [PATCH 2/2] pass fmt check --- src/wranglerjs/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wranglerjs/mod.rs b/src/wranglerjs/mod.rs index 6046d3759..fa61e1e17 100644 --- a/src/wranglerjs/mod.rs +++ b/src/wranglerjs/mod.rs @@ -328,7 +328,10 @@ fn use_legacy_openssl_if_necessary(command: &mut Command) -> Result<()> { let mut version_check_command = Command::new(&node); version_check_command.arg("--version"); let result = version_check_command.output()?.stdout; - let need_legacy_openssl = String::from_utf8_lossy(&result)[1..3].parse::().unwrap() >= 17; + let need_legacy_openssl = String::from_utf8_lossy(&result)[1..3] + .parse::() + .unwrap() + >= 17; let mut option_exists_command = Command::new(&node); option_exists_command.arg("--help");