Domanda

Where does stderr go on G-WAN, for example, if I have this ruby script:

require 'time'
START_TIME = Time.now    
ENV.each do |k,v|
  puts "#{k} => #{v} <br/>"
end   
RUNTIME = Time.now - START_TIME
puts "<br/>%.2f ms" % (RUNTIME*1000.0)
$stderr.puts "Test 123"
exit(200)

There are no Test 123 string on the logs/* directory or in the console when that script requested..

È stato utile?

Soluzione

Where does stderr go on G-WAN?

If I remember well, stdin, strerr and stdout are closed in the daemon mode because they are unreachable anyway as G-WAN was dettached from its parent terminal.

But in the 'interactive' mode, where G-WAN still shows console output like compilation errors and 'gracefull' crash reports (servlet crashes not crashing the server), these file descriptors are left opened.

This can be easily checked from any G-WAN using scripts that are loaded as modules (C, C++, C#, Java, PH7, Objective-C, etc.), that is, when scripts share the G-WAN memory space.

But when a CGI process is used instead because the script runtime was not loaded as a module (Ruby, Perl, etc.) this is different as G-WAN is running an external process and piping stdout.

In this later case, G-WAN would need another pipe to stream stderr. This was not done and this is why you see nothing when directing the output to stderr from a Ruby script.

Using more pipes would consume more file descriptors, and faster under server loads so, unless you have a compelling use for this feature that is worth sharing with us, it probably does not make much sense implementing it.

Ultimally, all scripted languages should use modules loaded in the G-WAN memory space because this allows far higher performance and concurrency.

Therefore, it is only a matter of time (and help from the Ruby community) before G-WAN can use stderr at no additional cost with Ruby.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top