1

Is it possible to turn off $stdout and $stderr and not re-direct it to a file; just turn it off so it prints out nothing to anywhere?

I've already tried the following code, but it just errors with error: Invalid argument

$stderr = IO.new(0,"w")
$stdout = IO.new(0,"w")
wurde
  • 2,487
  • 2
  • 20
  • 39
Thermatix
  • 2,757
  • 21
  • 51
  • *"so it prints out nothing to anywhere"* - printing everything to [nowhere](https://en.wikipedia.org/wiki/Null_device) is probably easier ;-) – Stefan Jul 13 '15 at 12:57

1 Answers1

5

This gist will show you how to redirect to /dev/null:

https://gist.github.com/moertel/11091573

Or this SO answer:

How do I redirect stderr and stdout to file for a Ruby script?

Your question probably needs to be marked as a dup.

Community
  • 1
  • 1
Michael Chaney
  • 2,911
  • 19
  • 26