# How to detect what is running Ruby program?

**URL:** <https://www.ruby-forum.com/t/how-to-detect-what-is-running-ruby-program/175884>\
**Category:** Ruby\
**Created:** [September 22, 2009, 6:33am UTC](https://www.ruby-forum.com/t/how-to-detect-what-is-running-ruby-program/175884 "2009-09-22T06:33:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![masonkessinger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4da419/32.png) [@masonkessinger](https://www.ruby-forum.com/u/masonkessinger)\
**Post date:** [September 22, 2009, 6:33am UTC](https://www.ruby-forum.com/t/how-to-detect-what-is-running-ruby-program/175884/1 "2009-09-22T06:33:55Z")

</div>

I work on a Windows platform and have two utiltities that I can execute  
a  
Ruby program from. The IDE SciTE and the fxri- Instant Ruby  
Enlightenment,  
or so it says. The input commands such as “gets” do not work in the  
SciTE  
utility but do in the fxri utility. If I use a gets command in a  
program  
while running on SciTE the system seems to freeze and nothing appears to  
be  
happening.

So I would like to be able to embed in my code the ability to recognize  
if I  
am running in fxri or SciTE to avoid executing a gets command while  
running  
in SciTE. Is there a way to do it? Since I use only these two  
utilities a  
detection of one would mean that I am not using the other.

Thanks in advance to the Ruby Masters.

No Sam

---

<div class="post-metadata">

**Author:** ![masonkessinger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4da419/32.png) [@masonkessinger](https://www.ruby-forum.com/u/masonkessinger)\
**Post date:** [September 22, 2009, 6:45am UTC](https://www.ruby-forum.com/t/how-to-detect-what-is-running-ruby-program/175884/2 "2009-09-22T06:45:02Z")

</div>

Perhaps try passing a command-line argument if you’re running from  
SciTE, which your program can detect and act accordingly? Assuming  
there’s no simpler way, that is.

~Jonathan

---

<div class="post-metadata">

**Author:** ![masonkessinger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4da419/32.png) [@masonkessinger](https://www.ruby-forum.com/u/masonkessinger)\
**Post date:** [September 22, 2009, 12:11pm UTC](https://www.ruby-forum.com/t/how-to-detect-what-is-running-ruby-program/175884/3 "2009-09-22T12:11:39Z")

</div>

On Tue, Sep 22, 2009 at 5:44 AM, Jonathan C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > I work on a Windows platform and have two utiltities that I can execute a  
> > Ruby program from. The IDE SciTE and the fxri- Instant Ruby Enlightenment,  
> > or so it says. The input commands such as “gets” do not work in the SciTE  
> > utility but do in the fxri utility. If I use a gets command in a program  
> > while running on SciTE the system seems to freeze and nothing appears to be  
> > happening.

IIRC there’s a difference between Kernel#gets and STDIN#gets, one of  
which works from under SciTE and the other doesn’t. Try changing your  
gets call to STDIN.gets.

Although personally, if you’re using SciTE that probably means you’re  
using the Ruby 1.8.6 one-click installer - which I would uninstall and  
move to the technology preview of Ruby 1.9, which doesn’t bundle  
SciTE, and instead has you work from the command line as God intended.

–  
Paul S.  
[http://www.nomadicfun.co.uk](http://www.nomadicfun.co.uk)

removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![masonkessinger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4da419/32.png) [@masonkessinger](https://www.ruby-forum.com/u/masonkessinger)\
**Post date:** [September 23, 2009, 4:13am UTC](https://www.ruby-forum.com/t/how-to-detect-what-is-running-ruby-program/175884/4 "2009-09-23T04:13:40Z")

</div>

You wrote, “…which doesn’t bundle SciTE, and instead has you work from  
the  
command line as God intended.”

Now I know why I’m an atheist! It’s that damn command line thingee!

So are people, who like to work from the authoritarian command line,  
programming fundamentalists?

I like SciTE, it’s a free IDE, even if it is of a different race. Why  
can’t  
we all just get a lawn?

No Sam

---

<div class="post-metadata">

**Author:** ![masonkessinger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4da419/32.png) [@masonkessinger](https://www.ruby-forum.com/u/masonkessinger)\
**Post date:** [September 23, 2009, 10:51am UTC](https://www.ruby-forum.com/t/how-to-detect-what-is-running-ruby-program/175884/5 "2009-09-23T10:51:14Z")

</div>

I’ll admit I liked SciTE when I first came across it, and I even used  
it to do a live Test Driven Development demo using Ruby at the place  
where I work.

However, I’m just happier with a command line and a good text editor.  
I’ve been using PSPad recently as we have it at work, but just use  
whatever your favourite editor happens to be.

In this year’s Google Code Jam I ditched the SciTE for a command line  
interface and performed much better - YMMV 🙂

On Wed, Sep 23, 2009 at 3:13 AM, Mason K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > > ~Jonathan  
> > > Enlightenment,  
> > > gets call to STDIN.gets.  
> > > removed\_email\_address@domain.invalid

–  
Paul S.  
[http://www.nomadicfun.co.uk](http://www.nomadicfun.co.uk)

removed\_email\_address@domain.invalid
