mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-07-01 12:43:17 +07:00
Fix race condition in get_file
This commit is contained in:
@ -7,8 +7,16 @@ async function get_file(filename: string) {
|
||||
let github_path: string =
|
||||
'https://raw.githubusercontent.com/shivammathur/setup-php/master/src/';
|
||||
const file: any = fs.createWriteStream(filename);
|
||||
https.get(github_path + filename, function(response: any) {
|
||||
response.pipe(file);
|
||||
file.on('open', function(fd: any) {
|
||||
https.get(github_path + filename, function(response: any) {
|
||||
response
|
||||
.on('data', function(chunk: any) {
|
||||
file.write(chunk);
|
||||
})
|
||||
.on('end', function() {
|
||||
file.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user