Skip to content

Commit

Permalink
Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryAstafyev committed Feb 7, 2025
1 parent 339bbe1 commit 932134b
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 902 deletions.
57 changes: 0 additions & 57 deletions application/holder/src/env/os/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import { exec, spawn } from 'child_process';

import * as os from 'os';

import { detectAvailableProfiles as getProfiles, ITerminalProfile } from './profiles';

export { getProfiles, ITerminalProfile };

export function shell(command: string, defShell?: string): Promise<string> {
return new Promise((resolve, reject) => {
exec(
Expand Down Expand Up @@ -40,43 +36,6 @@ export enum EPlatforms {

export type TEnvVars = { [key: string]: string };

export function printenv(shellFullPath?: string): Promise<TEnvVars> {
if (os.platform() === EPlatforms.win32) {
return Promise.reject(new Error(`This command doesn't supported by windows.`));
}
return new Promise((resolve, reject) => {
(() => {
if (shellFullPath === undefined) {
return getDefShell();
} else {
return Promise.resolve(shellFullPath);
}
})()
.then((defShell: string) => {
shell('printenv', defShell)
.then((stdout: string) => {
const pairs: TEnvVars = {};
stdout.split(/[\n\r]/gi).forEach((row: string) => {
const pair: string[] = row.split('=');
if (pair.length <= 1) {
return;
}
pairs[pair[0]] = row.replace(`${pair[0]}=`, '');
});
if (Object.keys(pairs).length === 0) {
return resolve(Object.assign({}, process.env) as TEnvVars);
}
resolve(pairs);
})
.catch((error: Error) => {
reject(error);
});
})
.catch((defShellErr: Error) => {
reject(defShellErr);
});
});
}
export function getElectronAppShellEnvVars(
electronPath: string,
shellFullPath?: string,
Expand Down Expand Up @@ -238,19 +197,3 @@ export function getDefShell(): Promise<string> {
});
});
}

export function getShells(): Promise<string[]> {
return new Promise((resolve, reject) => {
getProfiles()
.then((profiles: ITerminalProfile[]) => {
const shells: string[] = [];
profiles.forEach((p) => {
if (shells.indexOf(p.path) === -1) {
shells.push(p.path);
}
});
resolve(shells);
})
.catch(reject);
});
}
Loading

0 comments on commit 932134b

Please sign in to comment.