diff --git a/src/api/src/library/Platformio/index.ts b/src/api/src/library/Platformio/index.ts index 4eb1b110e..7bace7daa 100644 --- a/src/api/src/library/Platformio/index.ts +++ b/src/api/src/library/Platformio/index.ts @@ -31,14 +31,33 @@ const prependPATH = (pth: string, item: string): string => { return item; }; +const envFilter = ( + env: NodeJS.ProcessEnv, + blacklist: string[] +): NodeJS.ProcessEnv => { + const result: NodeJS.ProcessEnv = {}; + Object.keys(env).forEach((key) => { + if (!blacklist.includes(key)) { + result[key] = env[key]; + } + }); + return result; +}; + export default class Platformio { + private env: NodeJS.ProcessEnv; + constructor( private getPlatformioPath: string, private stateTempStoragePath: string, private PATH: string, - private env: NodeJS.ProcessEnv, + env: NodeJS.ProcessEnv, private logger: LoggerService - ) {} + ) { + // Fix for https://github.com/ExpressLRS/ExpressLRS-Configurator/issues/440 + const blacklistedEnvKeys = ['PYTHONPATH', 'PYTHONHOME']; + this.env = envFilter(env, blacklistedEnvKeys); + } async install(onUpdate: OnOutputFunc = NoOpFunc): Promise { const pyExec = await this.findPythonExecutable(this.PATH);