mirror of
https://github.com/hashicorp/setup-terraform.git
synced 2026-02-04 14:28:08 +00:00
Update shebang from wrapper to use the node version that action is running
This commit is contained in:
parent
b9cd54a3c3
commit
963824662d
1 changed files with 7 additions and 2 deletions
|
|
@ -81,8 +81,13 @@ async function installWrapper (pathToCLI) {
|
||||||
try {
|
try {
|
||||||
source = path.resolve([__dirname, '..', 'wrapper', 'dist', 'index.js'].join(path.sep));
|
source = path.resolve([__dirname, '..', 'wrapper', 'dist', 'index.js'].join(path.sep));
|
||||||
target = [pathToCLI, 'terraform'].join(path.sep);
|
target = [pathToCLI, 'terraform'].join(path.sep);
|
||||||
core.debug(`Copying ${source} to ${target}.`);
|
|
||||||
await io.cp(source, target);
|
core.debug(`Reading wrapper from ${source} and updating shebang.`);
|
||||||
|
const wrapperContent = (await fs.readFile(source, 'utf8')).split('\n');
|
||||||
|
wrapperContent[0] = `#!${process.argv[0]}`;
|
||||||
|
|
||||||
|
core.debug(`Writing updated wrapper to ${target}.`);
|
||||||
|
await fs.writeFile(target, wrapperContent.join('\n'));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
core.error(`Unable to copy ${source} to ${target}.`);
|
core.error(`Unable to copy ${source} to ${target}.`);
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue