I think we shouldn't build the daemon context in the daemon server using java's getInputArguments(). Instead, we might tell the daemon on startup what is his context.
Another problem with getInputArguments() is that it does not cope with system properties that contain a space, for example: -DsomeProp="i have spaces". For such system property input arguments for java <=6 are: "-DsomeProp=i", " have", " spaces". For gradle it means that if org.gradle.jvmargs contain sys properties that have spaces we will never connect to that daemon. The inputArguments() issue is documented here: http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=f84d44729bd8affffffffeb9b87963e2d752?bug_id=6459832 I found this problem few days ago when working with windows daemon.