Skip to content

Commit

Permalink
bandage the settings error
Browse files Browse the repository at this point in the history
  • Loading branch information
sylviiu committed Mar 5, 2024
1 parent 94250b5 commit b99c27c
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions util/currentVersion/pybridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,10 @@ module.exports = (forceCheck, getBuildDate, clear) => new Promise(async (res, re
}
});
});*/

child_process.execFile(path, [`--version-json`], {
env: { ...process.env,
PYBRIDGE_HEADER_SUPPORTED_SITES: `true`,
},
}, (err, stdout, stderr) => {
if(err) return res(null)

const parse = (data) => new Promise(async (res, rej) => {
try {
let version = JSON.parse((stdout ? stdout.toString('utf8').trim() : `` || stderr ? stderr.toString('utf8').trim() : ``));
let version = JSON.parse(data);

require(`../pythonBridge`).bridgeVersions = version;

Expand Down Expand Up @@ -88,6 +82,20 @@ module.exports = (forceCheck, getBuildDate, clear) => new Promise(async (res, re
rej(e);
}
});

child_process.execFile(path, [`--version-json`], {
env: { ...process.env,
PYBRIDGE_HEADER_SUPPORTED_SITES: `true`,
},
}, (err, stdout, stderr) => {
parse(stdout ? stdout.toString('utf8').trim() : `` || stderr ? stderr.toString('utf8').trim() : ``).then(res).catch(e => {
child_process.execFile(path, [`--version-json`], (err, stdout, stderr) => {
parse(stdout ? stdout.toString('utf8').trim() : `` || stderr ? stderr.toString('utf8').trim() : ``).then(res).catch(e => {
return res(null);
})
});
})
});
} else {
console.log(`File doesn't exist, returning null`);
return res(false)
Expand Down

0 comments on commit b99c27c

Please sign in to comment.