aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Dmitry Lomov <dslomov@google.com>2016-01-29 12:35:12 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2016-01-29 14:42:59 +0000
commit82434eb4648071f97d70b8c01dcecae224091b58 (patch)
tree47f6d0a9fa1eb2d630b290db64cd07bbd03a6a55 /src
parentcc9a2d112b9eb5ebacabdee43898a845cf594216 (diff)
Limit command line length to accomodate Windows.
-- MOS_MIGRATED_REVID=113350910
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java b/src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java
index bf51a301b4..41689a6761 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java
@@ -29,6 +29,7 @@ import com.google.devtools.build.lib.syntax.SkylarkDict;
import com.google.devtools.build.lib.syntax.SkylarkList;
import com.google.devtools.build.lib.syntax.SkylarkList.MutableList;
import com.google.devtools.build.lib.syntax.Type;
+import com.google.devtools.build.lib.util.OS;
import com.google.devtools.build.lib.util.Pair;
import com.google.devtools.build.lib.vfs.PathFragment;
@@ -59,9 +60,13 @@ public final class CommandHelper {
* If the command is very long, then we write the command to a script file,
* to avoid overflowing any limits on command-line length.
* For short commands, we just use /bin/bash -c command.
+ *
+ * Maximum command line length on Windows is 32767[1], but for cmd.exe it is 8192[2].
+ * [1] https://msdn.microsoft.com/en-us/library/ms682425(VS.85).aspx
+ * [2] https://support.microsoft.com/en-us/kb/830473.
*/
@VisibleForTesting
- public static int maxCommandLength = 64000;
+ public static int maxCommandLength = OS.getCurrent() == OS.WINDOWS ? 8000 : 64000;
/**
* A map of remote path prefixes and corresponding runfiles manifests for tools