Expand PATH with /usr/local/bin

Summary:
^

There is an issue whereas when Flipper Server is launched NOT from the terminal, it doesn't inherit the user's terminal `$PATH` variable.

This causes a few different issues.

This change tries to address that.

Reviewed By: passy

Differential Revision: D46392435

fbshipit-source-id: 6201a1749134db8c50eca8751af149737dce57d7
This commit is contained in:
Lorenzo Blasa
2023-06-02 08:01:51 -07:00
committed by Facebook GitHub Bot
parent 828d56f617
commit bb9793019c

View File

@@ -17,6 +17,7 @@ import {initializeLogger} from './logger';
import fs from 'fs-extra';
import yargs from 'yargs';
import open from 'open';
import os from 'os';
import {initCompanionEnv} from 'flipper-server-companion';
import {
checkPortInUse,
@@ -93,6 +94,16 @@ console.log(
}`,
);
/**
* When running as a standlone app not run from the terminal, the process itself
* doesn't inherit the user's terminal PATH environment variable.
* The PATH, when NOT launched from terminal is `/usr/bin:/bin:/usr/sbin:/sbin`
* which is missing `/usr/local/bin`.
*/
if (os.platform() !== 'win32') {
process.env.PATH = '/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin';
}
const rootPath = argv.bundler
? path.resolve(__dirname, '..', '..')
: path.resolve(__dirname, '..'); // in pre packaged versions of the server, static is copied inside the package