public void testUseNoLauncher() throws Exception {
Project project = new Project();
LineBuffer buffer = new LineBuffer();
ProcessTester server = new ProcessTester();
XhExecBgTask task = new XhExecBgTask();
task.setProject(project);
task.setExecutable(JVM);
task.createArg().setValue("-cp");
Path path = new Path(project, getClassPath());
task.createArg().setPath(path);
task.createArg().setLine(ProcessTester.class.getName());
task.createArg().setLine("-p " + server.getPort());
task.createArg().setLine("-s user.dir");
task.createArg().setLine("-t 60");
task.setUseLauncher(false);
task.enableLogging(buffer, 0, 1);
try {
task.execute();
// wait 250ms for process to start
Thread.sleep(250);
assertTrue("Process is not running", task.isRunning());
assertTrue("Process is not running", server.passed());
assertEquals("Wrong user dir",
System.getProperty("user.dir"),
server.getReceivedData());
task.kill();
assertTrue("Process is still running", !task.isRunning());
String cmdl = task.getCommandline();
assertTrue("Wrong commandline: " + cmdl, cmdl.indexOf("async_exec_launcher") < 0);
assertContains("Wrong commandline", JVM, cmdl);