Skip to content

Commit 77602f2

Browse files
Remove dead code
1 parent 339bbe1 commit 77602f2

File tree

4 files changed

+0
-902
lines changed

4 files changed

+0
-902
lines changed

application/holder/src/env/os/index.ts

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ import { exec, spawn } from 'child_process';
22

33
import * as os from 'os';
44

5-
import { detectAvailableProfiles as getProfiles, ITerminalProfile } from './profiles';
6-
7-
export { getProfiles, ITerminalProfile };
8-
95
export function shell(command: string, defShell?: string): Promise<string> {
106
return new Promise((resolve, reject) => {
117
exec(
@@ -40,43 +36,6 @@ export enum EPlatforms {
4036

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

43-
export function printenv(shellFullPath?: string): Promise<TEnvVars> {
44-
if (os.platform() === EPlatforms.win32) {
45-
return Promise.reject(new Error(`This command doesn't supported by windows.`));
46-
}
47-
return new Promise((resolve, reject) => {
48-
(() => {
49-
if (shellFullPath === undefined) {
50-
return getDefShell();
51-
} else {
52-
return Promise.resolve(shellFullPath);
53-
}
54-
})()
55-
.then((defShell: string) => {
56-
shell('printenv', defShell)
57-
.then((stdout: string) => {
58-
const pairs: TEnvVars = {};
59-
stdout.split(/[\n\r]/gi).forEach((row: string) => {
60-
const pair: string[] = row.split('=');
61-
if (pair.length <= 1) {
62-
return;
63-
}
64-
pairs[pair[0]] = row.replace(`${pair[0]}=`, '');
65-
});
66-
if (Object.keys(pairs).length === 0) {
67-
return resolve(Object.assign({}, process.env) as TEnvVars);
68-
}
69-
resolve(pairs);
70-
})
71-
.catch((error: Error) => {
72-
reject(error);
73-
});
74-
})
75-
.catch((defShellErr: Error) => {
76-
reject(defShellErr);
77-
});
78-
});
79-
}
8039
export function getElectronAppShellEnvVars(
8140
electronPath: string,
8241
shellFullPath?: string,
@@ -238,19 +197,3 @@ export function getDefShell(): Promise<string> {
238197
});
239198
});
240199
}
241-
242-
export function getShells(): Promise<string[]> {
243-
return new Promise((resolve, reject) => {
244-
getProfiles()
245-
.then((profiles: ITerminalProfile[]) => {
246-
const shells: string[] = [];
247-
profiles.forEach((p) => {
248-
if (shells.indexOf(p.path) === -1) {
249-
shells.push(p.path);
250-
}
251-
});
252-
resolve(shells);
253-
})
254-
.catch(reject);
255-
});
256-
}

0 commit comments

Comments
 (0)