mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Fix reading php version from file
This commit is contained in:
parent
bb16550379
commit
6bf279d08a
2
dist/index.js
vendored
2
dist/index.js
vendored
@ -1289,7 +1289,7 @@ async function resolveVersion() {
|
||||
}
|
||||
const versionFile = (await getInput('php-version-file', false)) || '.php-version';
|
||||
if (fs_1.default.existsSync(versionFile)) {
|
||||
return fs_1.default.readFileSync(versionFile, 'utf8');
|
||||
return fs_1.default.readFileSync(versionFile, 'utf8').replace(/[\r\n]/g, '');
|
||||
}
|
||||
else if (versionFile !== '.php-version') {
|
||||
throw new Error(`Could not find '${versionFile}' file.`);
|
||||
|
@ -435,7 +435,7 @@ export async function resolveVersion(): Promise<string> {
|
||||
const versionFile =
|
||||
(await getInput('php-version-file', false)) || '.php-version';
|
||||
if (fs.existsSync(versionFile)) {
|
||||
return fs.readFileSync(versionFile, 'utf8');
|
||||
return fs.readFileSync(versionFile, 'utf8').replace(/[\r\n]/g, '');
|
||||
} else if (versionFile !== '.php-version') {
|
||||
throw new Error(`Could not find '${versionFile}' file.`);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user