@@ -8,6 +8,9 @@ const { getVendors } = require('hexo-theme-next/scripts/events/lib/utils');
88const yargs = require ( 'yargs/yargs' ) ;
99const { hideBin } = require ( 'yargs/helpers' ) ;
1010
11+ // Process won't quit if keepAlive
12+ const agent = new https . Agent ( { keepAlive : false } ) ;
13+
1114const argv = yargs ( hideBin ( process . argv ) )
1215 . option ( 'diff' , {
1316 describe : 'Enable diff mode' ,
@@ -23,9 +26,9 @@ const dependencies = yaml.load(vendorsFile);
2326
2427const newPlugins = require ( '../package.json' ) . dependencies ;
2528
26- function request ( url ) {
29+ async function request ( url ) {
2730 return new Promise ( ( resolve , reject ) => {
28- const req = https . get ( url , response => {
31+ const req = https . get ( url , { agent } , response => {
2932 resolve ( response . statusCode ) ;
3033 } ) ;
3134 req . on ( 'error' , error => {
@@ -103,15 +106,15 @@ async function printDiff() {
103106 console . log ( 'The following packages are updated in the Pull Request.' ) ;
104107 console . log ( diff . map ( item => '- ' + item ) . join ( '\n' ) ) ;
105108 console . log ( '\nThe affected CDN links are listed below.' ) ;
106- printCDNTable ( diff ) ;
109+ await printCDNTable ( diff ) ;
107110 } else {
108111 console . log ( 'No packages are updated in the Pull Request.' ) ;
109112 }
110113}
111114
112115async function printAll ( ) {
113116 const names = Object . keys ( dependencies ) . map ( key => dependencies [ key ] . name ) ;
114- printCDNTable ( names ) ;
117+ await printCDNTable ( names ) ;
115118}
116119
117120if ( argv . diff ) {
0 commit comments