Skip to content

Commit bd485b6

Browse files
author
Sergey Dolin
committed
Add workaround to fix BOM-related error during parsing global.json
1 parent 23fa2c1 commit bd485b6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/setup-dotnet.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ export async function run() {
2020
const globalJsonPath = path.join(process.cwd(), 'global.json');
2121
if (fs.existsSync(globalJsonPath)) {
2222
const globalJson = JSON.parse(
23-
fs.readFileSync(globalJsonPath, {encoding: 'utf8'})
23+
// .trim() is necessary to strip BOM https://github.com/nodejs/node/issues/20649
24+
fs.readFileSync(globalJsonPath, {encoding: 'utf8'}).trim()
2425
);
2526
if (globalJson.sdk && globalJson.sdk.version) {
2627
version = globalJson.sdk.version;

0 commit comments

Comments
 (0)