Skip to content

Commit 15a208e

Browse files
authored
fix Path env on Windows (#268)
* fix Path env on Windows * show GCC version
1 parent 99b5c55 commit 15a208e

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ jobs:
4242
perl-version: "5.30.0"
4343
distribution: ${{ matrix.dist }}
4444
- run: perl -V
45+
- run: gcc --version
4546

4647
- run: npm run format-check

src/strawberry.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,15 @@ export async function getPerl(version: string) {
205205
core.debug('Perl tool is cached under ' + toolPath);
206206
}
207207

208-
const perlPath = path.join(toolPath, 'perl', 'bin');
209-
const cPath = path.join(toolPath, 'c', 'bin');
210-
core.addPath(perlPath);
211-
core.addPath(cPath); // for gcc-mingw bundled with strawberry perl
208+
// remove pre-installed Strawberry Perl and MinGW from Path
209+
let pathEnv = (process.env.PATH || '').split(path.delimiter);
210+
pathEnv = pathEnv.filter(p => !p.match(/.*(?:Strawberry|mingw).*/i));
211+
212+
// add our new Strawberry Portable Perl Paths
213+
pathEnv.unshift(path.join(toolPath, 'site', 'bin'));
214+
pathEnv.unshift(path.join(toolPath, 'c', 'bin'));
215+
pathEnv.unshift(path.join(toolPath, 'perl', 'bin'));
216+
core.exportVariable('PATH', pathEnv.join(path.delimiter));
212217
}
213218

214219
async function acquirePerl(version: PerlVersion): Promise<string> {

0 commit comments

Comments
 (0)