mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Fix race condition in get_file
This commit is contained in:
parent
202f1bbec1
commit
e5083c779b
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -1,58 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
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 fs = require('fs');
|
||||
function get_file(filename) {
|
||||
let github_path = 'https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/';
|
||||
const file = fs.createWriteStream(filename);
|
||||
const request = https.get(github_path + filename, function (response) {
|
||||
response.pipe(file);
|
||||
});
|
||||
}
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const version = core.getInput('php-version', { required: true });
|
||||
console.log('Input: ' + version);
|
||||
let os_version = process.platform;
|
||||
if (os_version == 'darwin') {
|
||||
get_file('darwin.sh');
|
||||
yield exec_1.exec('sudo chmod a+x darwin.sh');
|
||||
yield exec_1.exec('./darwin.sh ' + version);
|
||||
}
|
||||
else if (os_version == 'win32') {
|
||||
get_file('windows.ps1');
|
||||
yield exec_1.exec('powershell windows.ps1 -version ' + version);
|
||||
}
|
||||
else if (os_version == 'linux') {
|
||||
get_file('linux.sh');
|
||||
yield exec_1.exec('sudo chmod a+x linux.sh');
|
||||
yield exec_1.exec('./linux.sh ' + version);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
core.setFailed(err.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
run().then(() => {
|
||||
console.log('done');
|
||||
});
|
@ -1,4 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
let v = process.env['php-version'];
|
||||
console.log(v);
|
24
node_modules/@types/jest-diff/package.json
generated
vendored
24
node_modules/@types/jest-diff/package.json
generated
vendored
@ -1,32 +1,37 @@
|
||||
{
|
||||
"_from": "@types/jest-diff@*",
|
||||
"_args": [
|
||||
[
|
||||
"@types/jest-diff@20.0.1",
|
||||
"E:\\python\\setup-php"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@types/jest-diff@20.0.1",
|
||||
"_id": "@types/jest-diff@20.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-yALhelO3i0hqZwhjtcr6dYyaLoCHbAMshwtj6cGxTvHZAKXHsYGdff6E8EPw3xLKY0ELUTQ69Q1rQiJENnccMA==",
|
||||
"_location": "/@types/jest-diff",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@types/jest-diff@*",
|
||||
"raw": "@types/jest-diff@20.0.1",
|
||||
"name": "@types/jest-diff",
|
||||
"escapedName": "@types%2fjest-diff",
|
||||
"scope": "@types",
|
||||
"rawSpec": "*",
|
||||
"rawSpec": "20.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "*"
|
||||
"fetchSpec": "20.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@types/jest"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/jest-diff/-/jest-diff-20.0.1.tgz",
|
||||
"_shasum": "35cc15b9c4f30a18ef21852e255fdb02f6d59b89",
|
||||
"_spec": "@types/jest-diff@*",
|
||||
"_where": "E:\\python\\setup-php\\node_modules\\@types\\jest",
|
||||
"_spec": "20.0.1",
|
||||
"_where": "E:\\python\\setup-php",
|
||||
"bugs": {
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Alex Coles",
|
||||
@ -34,7 +39,6 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "TypeScript definitions for jest-diff",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
|
||||
"license": "MIT",
|
||||
|
22
node_modules/@types/jest/package.json
generated
vendored
22
node_modules/@types/jest/package.json
generated
vendored
@ -1,32 +1,37 @@
|
||||
{
|
||||
"_from": "@types/jest@^24.0.13",
|
||||
"_args": [
|
||||
[
|
||||
"@types/jest@24.0.18",
|
||||
"E:\\python\\setup-php"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@types/jest@24.0.18",
|
||||
"_id": "@types/jest@24.0.18",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-jcDDXdjTcrQzdN06+TSVsPPqxvsZA/5QkYfIZlq1JMw7FdP5AZylbOc+6B/cuDurctRe+MziUMtQ3xQdrbjqyQ==",
|
||||
"_location": "/@types/jest",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@types/jest@^24.0.13",
|
||||
"raw": "@types/jest@24.0.18",
|
||||
"name": "@types/jest",
|
||||
"escapedName": "@types%2fjest",
|
||||
"scope": "@types",
|
||||
"rawSpec": "^24.0.13",
|
||||
"rawSpec": "24.0.18",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^24.0.13"
|
||||
"fetchSpec": "24.0.18"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#DEV:/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@types/jest/-/jest-24.0.18.tgz",
|
||||
"_shasum": "9c7858d450c59e2164a8a9df0905fc5091944498",
|
||||
"_spec": "@types/jest@^24.0.13",
|
||||
"_spec": "24.0.18",
|
||||
"_where": "E:\\python\\setup-php",
|
||||
"bugs": {
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Asana",
|
||||
@ -120,7 +125,6 @@
|
||||
"dependencies": {
|
||||
"@types/jest-diff": "*"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "TypeScript definitions for Jest",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
|
||||
"license": "MIT",
|
||||
|
22
node_modules/fs/package.json
generated
vendored
22
node_modules/fs/package.json
generated
vendored
@ -1,34 +1,36 @@
|
||||
{
|
||||
"_from": "fs",
|
||||
"_args": [
|
||||
[
|
||||
"fs@0.0.1-security",
|
||||
"E:\\python\\setup-php"
|
||||
]
|
||||
],
|
||||
"_from": "fs@0.0.1-security",
|
||||
"_id": "fs@0.0.1-security",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ=",
|
||||
"_location": "/fs",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "fs",
|
||||
"raw": "fs@0.0.1-security",
|
||||
"name": "fs",
|
||||
"escapedName": "fs",
|
||||
"rawSpec": "",
|
||||
"rawSpec": "0.0.1-security",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
"fetchSpec": "0.0.1-security"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
|
||||
"_shasum": "8a7bd37186b6dddf3813f23858b57ecaaf5e41d4",
|
||||
"_spec": "fs",
|
||||
"_spec": "0.0.1-security",
|
||||
"_where": "E:\\python\\setup-php",
|
||||
"author": "",
|
||||
"bugs": {
|
||||
"url": "https://github.com/npm/security-holder/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "This package name is not currently in use, but was formerly occupied by another package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.",
|
||||
"homepage": "https://github.com/npm/security-holder#readme",
|
||||
"keywords": [],
|
||||
|
22
node_modules/https/package.json
generated
vendored
22
node_modules/https/package.json
generated
vendored
@ -1,35 +1,37 @@
|
||||
{
|
||||
"_from": "https",
|
||||
"_args": [
|
||||
[
|
||||
"https@1.0.0",
|
||||
"E:\\python\\setup-php"
|
||||
]
|
||||
],
|
||||
"_from": "https@1.0.0",
|
||||
"_id": "https@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-PDfHrhqO65ZpBKKtHpdaGUt+06Q=",
|
||||
"_location": "/https",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "https",
|
||||
"raw": "https@1.0.0",
|
||||
"name": "https",
|
||||
"escapedName": "https",
|
||||
"rawSpec": "",
|
||||
"rawSpec": "1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
"fetchSpec": "1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/https/-/https-1.0.0.tgz",
|
||||
"_shasum": "3c37c7ae1a8eeb966904a2ad1e975a194b7ed3a4",
|
||||
"_spec": "https",
|
||||
"_spec": "1.0.0",
|
||||
"_where": "E:\\python\\setup-php",
|
||||
"author": {
|
||||
"name": "hardus van der berg",
|
||||
"email": "hardus@sunfork.com",
|
||||
"url": "http://www.sunfork.com"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "https mediation",
|
||||
"keywords": [
|
||||
"https",
|
||||
|
28
package-lock.json
generated
28
package-lock.json
generated
@ -1761,12 +1761,14 @@
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
@ -1781,17 +1783,20 @@
|
||||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
@ -1908,7 +1913,8 @@
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
@ -1920,6 +1926,7 @@
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
@ -1934,6 +1941,7 @@
|
||||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
@ -1941,12 +1949,14 @@
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.3.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.0"
|
||||
@ -1965,6 +1975,7 @@
|
||||
"version": "0.5.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
@ -2045,7 +2056,8 @@
|
||||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
@ -2057,6 +2069,7 @@
|
||||
"version": "1.4.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
@ -2178,6 +2191,7 @@
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
|
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user