• SRCDS Console Output error
    4 replies, posted
I am making a (inb4 Language hate) Java based SRCDS manager, and I am stuck at grabbing console output. The console output is echoed into my Java console without problem, though SRCDS does not seem to like having it's logs stripped from it, and throws me this error, right before one can expect "VAC Secured" message at the end of server initialization. CTextConsoleWin32::GetLine: !GetNumberOfConsoleInputEvents My Java class is as follows: [CODE]try { Process process = new ProcessBuilder("H:\\Development\\Servers\\garrysmod\\srcds.exe","-game","garrysmod", "+map", "gm_construct", "-console").start(); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line; System.out.printf("Output of running %s is:", Arrays.toString(args)); while ((line = br.readLine()) != null) { System.out.println(line); } } catch (IOException ex) { System.out.println("Error."); }[/CODE] (Excuse that poor Exception) Any help is much appreciated :) Also, I stumbled upon this: [URL="https://facepunch.com/showthread.php?t=1181915"]thread[/URL] which is attempting something similar to what I am, just with C++, and I did not find a working solution.
I think you get this error because SRCDS tries to make its own console window by using the AllocConsole method. Try passing the following parameters: [code]-HFILE 1 -HPARENT 1 -HCHILD 1[/code] [URL="https://facepunch.com/showthread.php?t=1181915&p=49219582&viewfull=1#post49219582"]Stolen from this post.[/URL]
[QUOTE=maaatts;49937501]I think you get this error because SRCDS tries to make its own console window by using the AllocConsole method. Try passing the following parameters: [code]-HFILE 1 -HPARENT 1 -HCHILD 1[/code] [URL="https://facepunch.com/showthread.php?t=1181915&p=49219582&viewfull=1#post49219582"]Stolen from this post.[/URL][/QUOTE] I did actually try this, and I got an error along the lines of "Invalid handler", any other ideas?
Bump, still no avail. Running the script on Ubuntu 14.04 starts the server, but does not show console output. Can have one, or the other :/ doesn't seem like either platform wants to cooperate entirely.
Having the same issue. When running with a simple >> redirect, those flags do seem to redirect it to stdout, but Python subprocesses still only capture the srcds_run stuff (like the root warning) and not the actual server output.
Sorry, you need to Log In to post a reply to this thread.