Hey everyone
I have looked around for a while online and have come across a few things where this was reported broken and then fixed and then broken etc
Can someone confirm if I can output the console to file? has the method changed, is there a command im missing or has the feature been removed?
I have tried with powershell and C# and I am unable to get the console to output
thanks
stdout/stderr for dedicated server not outputting
Moderator: OpenTTD Developers
-
- Engineer
- Posts: 8
- Joined: 31 Dec 2016 10:59
Re: stdout/stderr for dedicated server not outputting
It does work, at least on non-Windows systems... however I do know we had to do some hackery to get the automated regression tests to work a while back when the current CI on Azure Pipelines was set up. I'm not sure console redirection works for dedicated servers on Windows, possibly only for the "null output" video driver.
There is an alternative command line option that instead sends all console output to a network socket, somehow.
There is an alternative command line option that instead sends all console output to a network socket, somehow.
-
- Engineer
- Posts: 8
- Joined: 31 Dec 2016 10:59
Re: stdout/stderr for dedicated server not outputting
ahh ok, that explains it then. I guess on a windows platform I will need to find a way to read it from the network redirect.
I saw a command line for that so thats something to look at.
Thank you
I saw a command line for that so thats something to look at.
Thank you
Re: stdout/stderr for dedicated server not outputting
there used to be a "convert" tool that turns a windows gui program into a windows console program.
-
- Engineer
- Posts: 8
- Joined: 31 Dec 2016 10:59
Re: stdout/stderr for dedicated server not outputting
yeah I found that but it was messy.
I got it working in the end with a 3rd party tool called netcat.
https://eternallybored.org/misc/netcat/
for anyone who finds this post and wants to do a similar thing, here is what I did.
Download netcat from the above link. I downloaded the 32bit version and extract the nc.exe file to wherever you need it. Mine was in "E:\openttd\Manager"
browse to the folder in powershell ISE.
run this code.
what this does is it will open the "nc" application and listen for any incoming information on port 3982.
once that is done, create a shortcut to openttd.exe, right click it and go to properties.
Under target, put these command line options at the end of the line
-D -d 2 -l 10.1.1.10
so it will looks something like
"E:\openttd\openttd.exe -D -d 2 -l 10.1.1.10"
note: the IP address i use for my internal network "10.1.1.10" is the ip address of the computer that is running the above powershell code.
the commandline -l <IP> outputs to a network port which in this case is netcat
if everything is done right, when you run the shortcut, it will load the dedicated server and output everything to the powershell window
If you have any questions or need help with this, let me know, I can do my best to assist
I got it working in the end with a 3rd party tool called netcat.
https://eternallybored.org/misc/netcat/
for anyone who finds this post and wants to do a similar thing, here is what I did.
Download netcat from the above link. I downloaded the 32bit version and extract the nc.exe file to wherever you need it. Mine was in "E:\openttd\Manager"
browse to the folder in powershell ISE.
run this code.
Code: Select all
$process = New-Object System.Diagnostics.Process
$process.StartInfo.UseShellExecute = $false
$process.StartInfo.RedirectStandardOutput = $true
$process.StartInfo.RedirectStandardError = $true
$process.StartInfo.CreateNoWindow = $false
$process.StartInfo.FileName = "E:\openttd\Manager\nc.exe"
$process.StartInfo.Arguments = "-l -p 3982"
$process.Start() | Out-Null
do
{
$outvar = $process.StandardOutput.ReadLine()
$outvar
}
while (!$Process.HasExited)
$process.WaitForExit()
once that is done, create a shortcut to openttd.exe, right click it and go to properties.
Under target, put these command line options at the end of the line
-D -d 2 -l 10.1.1.10
so it will looks something like
"E:\openttd\openttd.exe -D -d 2 -l 10.1.1.10"
note: the IP address i use for my internal network "10.1.1.10" is the ip address of the computer that is running the above powershell code.
the commandline -l <IP> outputs to a network port which in this case is netcat
if everything is done right, when you run the shortcut, it will load the dedicated server and output everything to the powershell window
If you have any questions or need help with this, let me know, I can do my best to assist
Who is online
Users browsing this forum: No registered users and 29 guests