Gradle must not reuse daemon if required privileges aren't matched

I started a build in a non-elevated command prompt. Some tests fail, because they need elevated privileges.

I then opened an elevated command prompt and started another build. It failed again, because it was now using the daemon which was started by the first run.

Gradle should start a new daemon with elevated privileges in this case and not reuse the previously started daemon.

This can also be a security issue in shared build environments if someone managed to execute some code as elevated which should have been run without elevated privileges.


Gradle 3.1

Build time: 2016-09-19 10:53:53 UTC
Revision: 13f38ba699afd86d7cdc4ed8fd7dd3960c0b1f97

Groovy: 2.4.7
Ant: Apache Antâ„¢ version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_74 (Oracle Corporation 25.74-b02)
OS: Windows 10 10.0 amd64