Disallow OUT_DIR on the command line

By the time we do argument parsing, we've already written to $OUT_DIR or
the default, so don't allow overriding the output directory on the
command line.

Test: m OUT_DIR=newdir
Change-Id: I6f8c07cbef3a71d393b766dc5a01ae9c3df8631c
This commit is contained in:
Dan Willemsen
2018-09-10 12:41:10 -07:00
parent c57d39cade
commit 6dfe30a5e2

View File

@@ -517,6 +517,9 @@ func (c *configImpl) parseArgs(ctx Context, args []string) {
ctx.Fatalln("Unknown option:", arg)
}
} else if k, v, ok := decodeKeyValue(arg); ok && len(k) > 0 {
if k == "OUT_DIR" {
ctx.Fatalln("OUT_DIR may only be set in the environment, not as a command line option.")
}
c.environ.Set(k, v)
} else if arg == "dist" {
c.dist = true