Skip to content

Commit

Permalink
Add workaround to fix BOM-related error during parsing global.json
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Dolin committed Apr 28, 2021
1 parent 23fa2c1 commit bd485b6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/setup-dotnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export async function run() {
const globalJsonPath = path.join(process.cwd(), 'global.json');
if (fs.existsSync(globalJsonPath)) {
const globalJson = JSON.parse(
fs.readFileSync(globalJsonPath, {encoding: 'utf8'})
// .trim() is necessary to strip BOM https://github.com/nodejs/node/issues/20649
fs.readFileSync(globalJsonPath, {encoding: 'utf8'}).trim()
);
if (globalJson.sdk && globalJson.sdk.version) {
version = globalJson.sdk.version;
Expand Down

0 comments on commit bd485b6

Please sign in to comment.