mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 18:38:33 +00:00
fix: attempt to only allow one deno process to update the node_modules folder at a time (#18058)
This is implemented in such a way that it should still allow processes to go through when a file lock wasn't properly cleaned up and the OS hasn't released it yet (but with a 200ms-ish delay). Closes #18039
This commit is contained in:
parent
72fe9bb470
commit
88b5fd9088
8 changed files with 301 additions and 7 deletions
|
@ -6,8 +6,11 @@ use deno_runtime::colors;
|
|||
|
||||
use crate::util::display::human_download_size;
|
||||
|
||||
use super::ProgressMessagePrompt;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ProgressDataDisplayEntry {
|
||||
pub prompt: ProgressMessagePrompt,
|
||||
pub message: String,
|
||||
pub position: u64,
|
||||
pub total_size: u64,
|
||||
|
@ -142,7 +145,7 @@ impl ProgressBarRenderer for TextOnlyProgressBarRenderer {
|
|||
|
||||
format!(
|
||||
"{} {}{}{}",
|
||||
colors::green("Download"),
|
||||
data.display_entry.prompt.as_text(),
|
||||
data.display_entry.message,
|
||||
colors::gray(bytes_text),
|
||||
colors::gray(total_text),
|
||||
|
@ -195,6 +198,7 @@ mod test {
|
|||
let renderer = BarProgressBarRenderer;
|
||||
let mut data = ProgressData {
|
||||
display_entry: ProgressDataDisplayEntry {
|
||||
prompt: ProgressMessagePrompt::Download,
|
||||
message: "data".to_string(),
|
||||
position: 0,
|
||||
total_size: 10 * BYTES_TO_KIB,
|
||||
|
@ -251,6 +255,7 @@ mod test {
|
|||
let renderer = TextOnlyProgressBarRenderer;
|
||||
let mut data = ProgressData {
|
||||
display_entry: ProgressDataDisplayEntry {
|
||||
prompt: ProgressMessagePrompt::Blocking,
|
||||
message: "data".to_string(),
|
||||
position: 0,
|
||||
total_size: 10 * BYTES_TO_KIB,
|
||||
|
@ -263,7 +268,7 @@ mod test {
|
|||
};
|
||||
let text = renderer.render(data.clone());
|
||||
let text = test_util::strip_ansi_codes(&text);
|
||||
assert_eq!(text, "Download data 0.00KiB/10.00KiB (2/3)");
|
||||
assert_eq!(text, "Blocking data 0.00KiB/10.00KiB (2/3)");
|
||||
|
||||
data.pending_entries = 0;
|
||||
data.total_entries = 1;
|
||||
|
@ -271,6 +276,6 @@ mod test {
|
|||
data.display_entry.total_size = 0;
|
||||
let text = renderer.render(data);
|
||||
let text = test_util::strip_ansi_codes(&text);
|
||||
assert_eq!(text, "Download data");
|
||||
assert_eq!(text, "Blocking data");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue