bool launchAndWait(String cmdline, void delegate(String line) callback){
	HANDLE hReadPipe, hWritePipe;
	SECURITY_ATTRIBUTES sa;
	sa.nLength = SECURITY_ATTRIBUTES.sizeof;
	sa.bInheritHandle = true;
	if(!CreatePipe(&hReadPipe, &hWritePipe, &sa, 0)){
		writefln("Failed to create pipe !");
		return false;
	}
	
	STARTUPINFO si;
	si.cb = STARTUPINFO.sizeof;
	si.hStdInput = null;
	si.hStdOutput = hWritePipe;
	si.hStdError = hWritePipe;
	
	PROCESS_INFORMATION pi;
	if( !CreateProcessA(null, cmdline, null, null, true,
	    NORMAL_PRIORITY_CLASS, null, null, &si, &pi)){
	    			STARTUPINFO si;
		CloseHandle( hReadPipe );
    	CloseHandle( hWritePipe );
    	writefln("Failed to create proccess !");
    	return false;
	}
	
	CloseHandle(pi.hThread);
	CloseHandle(hWritePipe);
	
	File file = new File(hReadPipe, FileMode.In);
	while(!file.eof()){
		String s = file.readLine();
		if(s.length  == 0 )
			break;
		callback(s);
	}
	file.close();
		
	int lError = 0;
	uint dwExitCode;
	switch(WaitForSingleObject(pi.hProcess, 5000)){
	case WAIT_OBJECT_0:
		// Process exit successfully
		break;
	default:
		// Something error	or timeout		
		lError = GetLastError();			
		break;
	}

	if( lError != ERROR_SUCCESS ){
		// check if the proccess still active			      
		if( GetExitCodeThread(pi.hThread, &dwExitCode) && dwExitCode == STILL_ACTIVE ){
			// Kill the proccess
			TerminateThread(pi.hThread, dwExitCode);
		}						
	}
	CloseHandle(pi.hThread); 
	CloseHandle(pi.hProcess);
	return lError == ERROR_SUCCESS;
}