File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,9 @@ pub(super) struct Notifier {
133
133
impl Notifier {
134
134
pub ( super ) fn new ( verbose : bool , quiet : bool ) -> Self {
135
135
Self {
136
- tracker : DownloadTracker :: new_with_display_progress ( !quiet) ,
136
+ tracker : Arc :: new ( Mutex :: new ( DownloadTracker :: new_with_display_progress (
137
+ !quiet,
138
+ ) ) ) ,
137
139
ram_notice_shown : RefCell :: new ( false ) ,
138
140
verbose,
139
141
}
Original file line number Diff line number Diff line change 1
1
use std:: collections:: VecDeque ;
2
2
use std:: fmt;
3
3
use std:: io:: Write ;
4
- use std:: sync:: { Arc , Mutex } ;
5
4
use std:: time:: { Duration , Instant } ;
6
5
7
6
use crate :: currentprocess:: { process, terminalsource} ;
@@ -50,8 +49,8 @@ pub(crate) struct DownloadTracker {
50
49
51
50
impl DownloadTracker {
52
51
/// Creates a new DownloadTracker.
53
- pub ( crate ) fn new_with_display_progress ( display_progress : bool ) -> Arc < Mutex < Self > > {
54
- Arc :: new ( Mutex :: new ( Self {
52
+ pub ( crate ) fn new_with_display_progress ( display_progress : bool ) -> Self {
53
+ Self {
55
54
content_len : None ,
56
55
total_downloaded : 0 ,
57
56
downloaded_this_sec : 0 ,
@@ -62,7 +61,7 @@ impl DownloadTracker {
62
61
displayed_charcount : None ,
63
62
units : vec ! [ Unit :: B ] ,
64
63
display_progress,
65
- } ) )
64
+ }
66
65
}
67
66
68
67
pub ( crate ) fn handle_notification ( & mut self , n : & Notification < ' _ > ) -> bool {
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ use std::io::Write;
5
5
use std:: os:: windows:: ffi:: { OsStrExt , OsStringExt } ;
6
6
use std:: path:: Path ;
7
7
use std:: process:: Command ;
8
+ use std:: sync:: { Arc , Mutex } ;
8
9
9
10
use anyhow:: { anyhow, Context , Result } ;
10
11
@@ -179,7 +180,7 @@ pub(crate) async fn try_install_msvc(opts: &InstallOpts<'_>) -> Result<ContinueI
179
180
. context ( "error creating temp directory" ) ?;
180
181
181
182
let visual_studio = tempdir. path ( ) . join ( "vs_setup.exe" ) ;
182
- let download_tracker = DownloadTracker :: new_with_display_progress ( true ) ;
183
+ let download_tracker = Arc :: new ( Mutex :: new ( DownloadTracker :: new_with_display_progress ( true ) ) ) ;
183
184
download_tracker. lock ( ) . unwrap ( ) . download_finished ( ) ;
184
185
185
186
info ! ( "downloading Visual Studio installer" ) ;
You can’t perform that action at this time.
0 commit comments