added a tester code

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17019 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2009-04-10 05:48:49 +00:00
1 parent bd4fccf804
commit 4fe546feeb
2 files changed
+26 -2

No files matched your search

+6 -2
View File
@@ -111,13 +111,17 @@ public abstract class SU {
return task.call();
String javaExe = System.getProperty("java.home") + "/bin/java";
String slaveJar = Which.jarFile(Launcher.class).getAbsolutePath();
File slaveJar = Which.jarFile(Launcher.class);
// otherwise first attempt pfexec, as that doesn't require password
Channel channel;
Process proc=null;
ArgumentListBuilder args = new ArgumentListBuilder().add(javaExe, "-jar", slaveJar);
ArgumentListBuilder args = new ArgumentListBuilder().add(javaExe);
if(slaveJar.isFile())
args.add("-jar").add(slaveJar);
else // in production code this never happens, but during debugging this is convenient
args.add("-cp").add(slaveJar).add(hudson.remoting.Launcher.class.getName());
if(rootPassword==null) {
// try sudo, in the hope that the user has the permission to do so without password