From 6ee983b12741d2c38b7d2babb88f5ace317dc4b4 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 7 Jun 2021 22:29:47 -0400 Subject: [PATCH] chore(tools): Fix stdout buffer of launched process getting full causing tools/lint.js to hang on Windows (#10888) Also fix Windows only clippy issues. --- runtime/permissions.rs | 11 +++++++---- tools/util.js | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/runtime/permissions.rs b/runtime/permissions.rs index d98bcc71a6..f8385e2013 100644 --- a/runtime/permissions.rs +++ b/runtime/permissions.rs @@ -605,17 +605,20 @@ impl UnaryPermission { pub fn request(&mut self, env: Option<&str>) -> PermissionState { if let Some(env) = env { - #[cfg(windows)] - let env = env.to_uppercase(); + let env = if cfg!(windows) { + env.to_uppercase() + } else { + env.to_string() + }; let state = self.query(Some(&env)); if state == PermissionState::Prompt { if permission_prompt(&format!("env access to \"{}\"", env)) { self.granted_list.retain(|env_| env_.0 != env); - self.granted_list.insert(EnvDescriptor(env.to_string())); + self.granted_list.insert(EnvDescriptor(env)); PermissionState::Granted } else { self.denied_list.retain(|env_| env_.0 != env); - self.denied_list.insert(EnvDescriptor(env.to_string())); + self.denied_list.insert(EnvDescriptor(env)); self.global_state = PermissionState::Denied; PermissionState::Denied } diff --git a/tools/util.js b/tools/util.js index 98ccc77ce8..cd9e303146 100644 --- a/tools/util.js +++ b/tools/util.js @@ -17,12 +17,12 @@ async function getFilesFromGit(baseDir, cmd) { cmd, stdout: "piped", }); + const output = new TextDecoder().decode(await p.output()); const { success } = await p.status(); if (!success) { throw new Error("gitLsFiles failed"); } - const output = new TextDecoder().decode(await p.output()); p.close(); const files = output.split("\0").filter((line) => line.length > 0).map(