Fix : windows verify crash 1
This commit is contained in:
@@ -26,7 +26,10 @@ const CONFIG_PATH = path.resolve(
|
||||
function readFile(): Partial<AgentConfig> {
|
||||
if (!fs.existsSync(CONFIG_PATH)) return {};
|
||||
try {
|
||||
return JSON.parse(fs.readFileSync(CONFIG_PATH, 'utf8')) as Partial<AgentConfig>;
|
||||
// Les éditeurs Windows (et Set-Content -Encoding UTF8) préfixent un BOM que
|
||||
// JSON.parse rejette.
|
||||
const raw = fs.readFileSync(CONFIG_PATH, 'utf8').replace(/^\uFEFF/, '');
|
||||
return JSON.parse(raw) as Partial<AgentConfig>;
|
||||
} catch (err) {
|
||||
console.error(`Configuration illisible (${CONFIG_PATH}) :`, err);
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user