File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import {
2626 showAndLogWarningMessage ,
2727} from "../common/logging" ;
2828import { unzipToDirectoryConcurrently } from "../common/unzip-concurrently" ;
29+ import { reportUnzipProgress } from "../common/vscode/unzip-progress" ;
2930
3031/**
3132 * distribution.ts
@@ -423,6 +424,12 @@ class ExtensionSpecificDistributionManager {
423424 await unzipToDirectoryConcurrently (
424425 archivePath ,
425426 this . getDistributionStoragePath ( ) ,
427+ progressCallback
428+ ? reportUnzipProgress (
429+ `Extracting CodeQL CLI ${ release . name } …` ,
430+ progressCallback ,
431+ )
432+ : undefined ,
426433 ) ;
427434 } finally {
428435 await remove ( tmpDirectory ) ;
Original file line number Diff line number Diff line change @@ -108,6 +108,10 @@ export function withInheritedProgress<R>(
108108 }
109109}
110110
111+ export function readableBytesMb ( numBytes : number ) : string {
112+ return `${ ( numBytes / ( 1024 * 1024 ) ) . toFixed ( 1 ) } MB` ;
113+ }
114+
111115/**
112116 * Displays a progress monitor that indicates how much progess has been made
113117 * reading from a stream.
@@ -125,15 +129,13 @@ export function reportStreamProgress(
125129) {
126130 if ( progress && totalNumBytes ) {
127131 let numBytesDownloaded = 0 ;
128- const bytesToDisplayMB = ( numBytes : number ) : string =>
129- `${ ( numBytes / ( 1024 * 1024 ) ) . toFixed ( 1 ) } MB` ;
130132 const updateProgress = ( ) => {
131133 progress ( {
132134 step : numBytesDownloaded ,
133135 maxStep : totalNumBytes ,
134- message : `${ messagePrefix } [${ bytesToDisplayMB (
136+ message : `${ messagePrefix } [${ readableBytesMb (
135137 numBytesDownloaded ,
136- ) } of ${ bytesToDisplayMB ( totalNumBytes ) } ]`,
138+ ) } of ${ readableBytesMb ( totalNumBytes ) } ]`,
137139 } ) ;
138140 } ;
139141
Original file line number Diff line number Diff line change 1+ import { UnzipProgressCallback } from "../unzip" ;
2+ import { ProgressCallback , readableBytesMb } from "./progress" ;
3+
4+ export function reportUnzipProgress (
5+ messagePrefix : string ,
6+ progress : ProgressCallback ,
7+ ) : UnzipProgressCallback {
8+ return ( { bytesExtracted, totalBytes } ) => {
9+ progress ( {
10+ step : bytesExtracted ,
11+ maxStep : totalBytes ,
12+ message : `${ messagePrefix } [${ readableBytesMb (
13+ bytesExtracted ,
14+ ) } of ${ readableBytesMb ( totalBytes ) } ]`,
15+ } ) ;
16+ } ;
17+ }
You can’t perform that action at this time.
0 commit comments