@@ -44,30 +44,24 @@ async function prepareRootDir() {
4444}
4545
4646async function getWDAPrebuiltPackage ( ) {
47+ const destDir = await prepareRootDir ( ) ;
48+ const platform = parseArgValue ( 'platform' ) ;
49+ const zipFileName = destZip ( platform ) ;
50+ const wdaVersion = await webdriveragentPkgVersion ( ) ;
51+ const urlToDownload = wdaUrl ( wdaVersion , zipFileName ) ;
52+ const downloadedZipFile = path . join ( destDir , zipFileName ) ;
4753 try {
48- const destDir = await prepareRootDir ( ) ;
49- const platform = parseArgValue ( 'platform' ) ;
50- const zipFileName = destZip ( platform ) ;
51- const wdaVersion = await webdriveragentPkgVersion ( ) ;
52- const urlToDownload = wdaUrl ( wdaVersion , zipFileName ) ;
53- const downloadedZipFile = path . join ( destDir , zipFileName ) ;
54- try {
55- log . info ( `Downloading ${ urlToDownload } ` ) ;
56- await net . downloadFile ( urlToDownload , downloadedZipFile ) ;
54+ log . info ( `Downloading ${ urlToDownload } ` ) ;
55+ await net . downloadFile ( urlToDownload , downloadedZipFile ) ;
5756
58- log . info ( `Unpacking ${ downloadedZipFile } into ${ destDir } ` ) ;
59- await zip . extractAllTo ( downloadedZipFile , destDir ) ;
57+ log . info ( `Unpacking ${ downloadedZipFile } into ${ destDir } ` ) ;
58+ await zip . extractAllTo ( downloadedZipFile , destDir ) ;
6059
61- log . info ( `Deleting ${ downloadedZipFile } ` ) ;
62- } finally {
63- if ( await fs . exists ( downloadedZipFile ) ) {
64- await fs . unlink ( downloadedZipFile ) ;
65- }
60+ log . info ( `Deleting ${ downloadedZipFile } ` ) ;
61+ } finally {
62+ if ( await fs . exists ( downloadedZipFile ) ) {
63+ await fs . unlink ( downloadedZipFile ) ;
6664 }
67- process . exit ( 0 ) ;
68- } catch ( err ) {
69- log . error ( err . message || err ) ;
70- process . exit ( 1 ) ;
7165 }
7266}
7367
0 commit comments