Skip to content

Commit 5f19d3c

Browse files
Fix https connection
1 parent 76c5526 commit 5f19d3c

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

lib/comment.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ const { getVendors } = require('hexo-theme-next/scripts/events/lib/utils');
88
const yargs = require('yargs/yargs');
99
const { hideBin } = require('yargs/helpers');
1010

11+
// Process won't quit if keepAlive
12+
const agent = new https.Agent({ keepAlive: false });
13+
1114
const argv = yargs(hideBin(process.argv))
1215
.option('diff', {
1316
describe: 'Enable diff mode',
@@ -23,9 +26,9 @@ const dependencies = yaml.load(vendorsFile);
2326

2427
const 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

112115
async function printAll() {
113116
const names = Object.keys(dependencies).map(key => dependencies[key].name);
114-
printCDNTable(names);
117+
await printCDNTable(names);
115118
}
116119

117120
if (argv.diff) {

0 commit comments

Comments
 (0)