How can I indicate from ruby script whether it is running from the command line, for example:
> ruby myscript.rb
or from a non-interactive process, for example. hron?
$stdin.tty? will return true if connected to the terminal otherwise false.
$stdin.tty?
Is there a little additional information on the recommendation for using STDIN in Ruby?
Source: https://habr.com/ru/post/1755319/More articles:How to create an independent copy of Delphi TBitmap? - delphiКак преобразовать QMap> в QVariant? - c++Custom frame in WPF - wpfКак "сделать что-то" в определенное время и день недели в java? - javaCan I zoom in on a webpage? - javascriptHow can I immediately update WPF binding - data-bindingRunning PHP script in the background without curls - phpMasking a text field without changing a model value in ASP.NET MVC - typesGet the current Drupal theme? - drupalUnusual runtime of date functions in Oracle - sqlAll Articles