Skip to content

Commit

Permalink
fix(utils/env-manager): fixes setting of default environment variable…
Browse files Browse the repository at this point in the history
…s; sets empty as undefined
  • Loading branch information
rafamel committed May 13, 2019
1 parent 3611057 commit 9a09e8c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/env-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export default class EnvManager {
return this.env[key] || undefined;
}
public set(key: string, value?: string): void {
this.assign({ [key]: value || '' });
this.assign({ [key]: value });
}
public default(key: string, value: string): string {
return this.get(key) || this.set(value) || value;
return this.get(key) || this.set(key, value) || value;
}
public addPaths(paths: string[]): void {
const env = { PATH: this.env[this.path] };
Expand All @@ -35,7 +35,7 @@ export default class EnvManager {
const toRestore = Object.keys(this.assigned).reduce(
(acc: IOfType<string | undefined>, key) => {
if (this.env[key] === this.assigned[key]) {
acc[key] = this.initial[key] || '';
acc[key] = this.initial[key];
}
return acc;
},
Expand Down

0 comments on commit 9a09e8c

Please sign in to comment.