Fix race condition in get_file
This commit is contained in:
+12
-4
@@ -18,14 +18,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const exec_1 = require("@actions/exec/lib/exec");
|
||||
var https = require('https');
|
||||
const https = require('https');
|
||||
const fs = require('fs');
|
||||
function get_file(filename) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let github_path = 'https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/';
|
||||
let github_path = 'https://raw.githubusercontent.com/shivammathur/setup-php/master/src/';
|
||||
const file = fs.createWriteStream(filename);
|
||||
const request = https.get(github_path + filename, function (response) {
|
||||
response.pipe(file);
|
||||
file.on('open', function (fd) {
|
||||
https.get(github_path + filename, function (response) {
|
||||
response
|
||||
.on('data', function (chunk) {
|
||||
file.write(chunk);
|
||||
})
|
||||
.on('end', function () {
|
||||
file.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user