diff --git a/platform/util/src/com/intellij/util/EnvironmentUtil.java b/platform/util/src/com/intellij/util/EnvironmentUtil.java index 768b5623fc83..c27806a49b48 100644 --- a/platform/util/src/com/intellij/util/EnvironmentUtil.java +++ b/platform/util/src/com/intellij/util/EnvironmentUtil.java @@ -53,6 +53,7 @@ public class EnvironmentUtil { private static final String LC_CTYPE = "LC_CTYPE"; private static final Future> ourEnvGetter; + static { if (SystemInfo.isMac && "unlocked".equals(System.getProperty("__idea.mac.env.lock")) && Registry.is("idea.fix.mac.env")) { ourEnvGetter = AppExecutorUtil.getAppExecutorService().submit(new Callable>() { @@ -149,6 +150,8 @@ public class EnvironmentUtil { return array; } + private static final String DISABLE_OMZ_AUTO_UPDATE = "DISABLE_AUTO_UPDATE"; + private static Map getShellEnv() throws Exception { String shell = System.getenv("SHELL"); if (shell == null || !new File(shell).canExecute()) { @@ -168,15 +171,16 @@ public class EnvironmentUtil { String[] command = {shell, "-l", "-i", "-c", "'" + reader.getAbsolutePath() + "' '" + envFile.getAbsolutePath() + "'"}; LOG.info("loading shell env: " + StringUtil.join(command, " ")); - Process process = new ProcessBuilder(command).redirectErrorStream(true).start(); + ProcessBuilder builder = new ProcessBuilder(command).redirectErrorStream(true); + builder.environment().put(DISABLE_OMZ_AUTO_UPDATE, "true"); + Process process = builder.start(); StreamGobbler gobbler = new StreamGobbler(process.getInputStream()); int rv = waitAndTerminateAfter(process, SHELL_ENV_READING_TIMEOUT); gobbler.stop(); String lines = FileUtil.loadFile(envFile); if (rv != 0 || lines.isEmpty()) { - LOG.info("shell process output: " + StringUtil.trimEnd(gobbler.getText(), '\n')); - throw new Exception("rv:" + rv + " text:" + lines.length()); + throw new Exception("rv:" + rv + " text:" + lines.length() + " out:" + StringUtil.trimEnd(gobbler.getText(), '\n')); } return parseEnv(lines); } @@ -186,7 +190,7 @@ public class EnvironmentUtil { } private static Map parseEnv(String text) throws Exception { - Set toIgnore = new HashSet(Arrays.asList("_", "PWD", "SHLVL")); + Set toIgnore = new HashSet(Arrays.asList("_", "PWD", "SHLVL", DISABLE_OMZ_AUTO_UPDATE)); Map env = System.getenv(); Map newEnv = new HashMap(); @@ -299,7 +303,6 @@ public class EnvironmentUtil { } private static class StreamGobbler extends BaseOutputReader { - private final StringBuffer myBuffer; public StreamGobbler(@NotNull InputStream stream) { @@ -324,4 +327,4 @@ public class EnvironmentUtil { return myBuffer.toString(); } } -} +} \ No newline at end of file diff --git a/platform/util/testSrc/com/intellij/util/EnvironmentUtilTest.java b/platform/util/testSrc/com/intellij/util/EnvironmentUtilTest.java index 9728f9b70390..4d51cb94a75f 100644 --- a/platform/util/testSrc/com/intellij/util/EnvironmentUtilTest.java +++ b/platform/util/testSrc/com/intellij/util/EnvironmentUtilTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,4 +63,4 @@ public class EnvironmentUtilTest { Map env = EnvironmentUtil.testLoader(); assertTrue(env.size() >= System.getenv().size() / 2); } -} +} \ No newline at end of file