提交 4cd1c0fc 编写于 作者: D Daniel Imms

Support multi-line environment variables

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
上级 0e1ed936
......@@ -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],
});
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册