Skip to content

Commit

Permalink
feat(process): add getPathParts to split path into parts
Browse files Browse the repository at this point in the history
  • Loading branch information
imhoffd committed Mar 3, 2019
1 parent cea51c6 commit 7dfbbc2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/@ionic/utils-process/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createCaseInsensitiveObject } from '@ionic/utils-object';
import { TERMINAL_INFO } from '@ionic/utils-terminal';
import * as Debug from 'debug';
import * as lodash from 'lodash';
import * as pathlib from 'path';
import * as kill from 'tree-kill';

const debug = Debug('ionic:utils-process');
Expand Down Expand Up @@ -29,10 +30,17 @@ export function killProcessTree(pid: number, signal: string | number = 'SIGTERM'
* sensitivity matters. This method creates an empty "`process.env`" object
* type that works for all platforms.
*/
export function createProcessEnv(...sources: { [key: string]: string | undefined; }[]): { [key: string]: string; } {
export function createProcessEnv(...sources: { [key: string]: string | undefined; }[]): NodeJS.ProcessEnv {
return lodash.assign(TERMINAL_INFO.windows ? createCaseInsensitiveObject() : {}, ...sources);
}

/**
* Split a PATH string into path parts.
*/
export function getPathParts(envpath = process.env.PATH || ''): string[] {
return envpath.split(pathlib.delimiter);
}

/**
* Resolves when the given amount of milliseconds has passed.
*/
Expand Down

0 comments on commit 7dfbbc2

Please # to comment.