mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
Add cli to path when running from AppImage
This commit is contained in:
parent
0a7a0e6078
commit
ff40cdb578
2 changed files with 15 additions and 0 deletions
|
|
@ -5,6 +5,8 @@ import {getDecoratedEnv} from './plugins';
|
|||
import {productName, version} from './package.json';
|
||||
import * as config from './config';
|
||||
import {IPty, IWindowsPtyForkOptions, spawn as npSpawn} from 'node-pty';
|
||||
import {cliScriptPath} from './config/paths';
|
||||
import {dirname} from 'path';
|
||||
|
||||
const createNodePtyError = () =>
|
||||
new Error(
|
||||
|
|
@ -118,6 +120,14 @@ export default class Session extends EventEmitter {
|
|||
envFromConfig
|
||||
);
|
||||
|
||||
// path to AppImage mount point is added to PATH environment variable automatically
|
||||
// which conflicts with the cli
|
||||
if (baseEnv['APPIMAGE'] && baseEnv['APPDIR']) {
|
||||
baseEnv['PATH'] = [dirname(cliScriptPath)]
|
||||
.concat((baseEnv['PATH'] || '').split(':').filter((val) => !val.startsWith(baseEnv['APPDIR'])))
|
||||
.join(':');
|
||||
}
|
||||
|
||||
// Electron has a default value for process.env.GOOGLE_API_KEY
|
||||
// We don't want to leak this to the shell
|
||||
// See https://github.com/vercel/hyper/issues/696
|
||||
|
|
|
|||
|
|
@ -134,6 +134,11 @@ export const installCLI = async (withNotification: boolean) => {
|
|||
logNotify(withNotification, 'Hyper CLI installation failed', `Failed to add Hyper CLI path to user PATH ${err}`);
|
||||
}
|
||||
} else if (process.platform === 'darwin' || process.platform === 'linux') {
|
||||
// AppImages are mounted on run at a temporary path, don't create symlink
|
||||
if (process.env['APPIMAGE']) {
|
||||
console.log('Skipping CLI symlink creation as it is an AppImage install');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await addSymlink(!withNotification);
|
||||
logNotify(withNotification, 'Hyper CLI installed', `Symlink created at ${cliLinkPath}`);
|
||||
|
|
|
|||
Loading…
Reference in a new issue