Skip to content

Commit

Permalink
Support multi-line environment variables
Browse files Browse the repository at this point in the history
A standard Fedora install comes with 2 multiple line environment variables.
Since `env` was previously split by '\n' this would break them, causing
errors in the output pane and in terminals launched through the file
explorer (see #3495).

Fixes #3928
  • Loading branch information
Tyriar committed Mar 24, 2016
1 parent 0e1ed93 commit 4cd1c0f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/vs/base/node/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export function getUserEnvironment(): TPromise<IEnv> {
}

return new TPromise((c, e) => {
let child = cp.spawn(process.env.SHELL, ['-ilc', 'env'], {
// Use --null and split by '\0' as splitting by '\n' breaks multi-line environment variables
let child = cp.spawn(process.env.SHELL, ['-ilc', 'env', '--null'], {
detached: true,
stdio: ['ignore', 'pipe', process.stderr],
});
Expand All @@ -37,7 +38,7 @@ export function getUserEnvironment(): TPromise<IEnv> {

let result: IEnv = Object.create(null);

buffer.split('\n').forEach(line => {
buffer.split('\0').forEach(line => {
let pos = line.indexOf('=');
if (pos > 0) {
let key = line.substring(0, pos);
Expand Down

0 comments on commit 4cd1c0f

Please sign in to comment.