How to detect what is running Ruby program?

Discussion in 'Ruby' started by Mason Kelsey, Sep 22, 2009.

  1. Mason Kelsey

    Mason Kelsey Guest

    [Note: parts of this message were removed to make it a legal post.]

    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
    Mason Kelsey, Sep 22, 2009
    #1
    1. Advertising

  2. Perhaps try passing a command-line argument if you're running from SciTE=2C=
    which your program can detect and act accordingly? Assuming there's no sim=
    pler way=2C that is.

    ~Jonathan


    > Date: Tue=2C 22 Sep 2009 13:33:23 +0900
    > From:
    > Subject: How to detect what is running Ruby program?
    > To:
    >=20
    > 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 Enlightenmen=

    t=2C
    > or so it says. The input commands such as "gets" do not work in the SciT=

    E
    > 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.
    >=20
    > So I would like to be able to embed in my code the ability to recognize i=

    f I
    > am running in fxri or SciTE to avoid executing a gets command while runni=

    ng
    > 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.
    >=20
    > Thanks in advance to the Ruby Masters.
    >=20
    > No Sam


    _________________________________________________________________
    Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
    http://clk.atdmt.com/GBL/go/171222985/direct/01/=
    Jonathan Castello, Sep 22, 2009
    #2
    1. Advertising

  3. Mason Kelsey

    Paul Smith Guest

    On Tue, Sep 22, 2009 at 5:44 AM, Jonathan Castello <> wr=
    ote:
    >
    > 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 sim=
    pler way, that is.
    >
    > ~Jonathan
    >
    >
    >> Date: Tue, 22 Sep 2009 13:33:23 +0900
    >> From:
    >> Subject: How to detect what is running Ruby program?
    >> To:
    >>
    >> I work on a Windows platform and have two utiltities that I can execute =

    a
    >> Ruby program from. =A0The IDE SciTE and the fxri- Instant Ruby Enlighten=

    ment,
    >> or so it says. =A0The input commands such as "gets" do not work in the S=

    ciTE
    >> utility but do in the fxri utility. =A0If I use a gets command in a prog=

    ram
    >> 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.

    --=20
    Paul Smith
    http://www.nomadicfun.co.uk

    Paul Smith, Sep 22, 2009
    #3
  4. Mason Kelsey

    Mason Kelsey Guest

    [Note: parts of this message were removed to make it a legal post.]

    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
    On Tue, Sep 22, 2009 at 6:10 AM, Paul Smith <> wrote:

    > On Tue, Sep 22, 2009 at 5:44 AM, Jonathan Castello <>
    > wrote:
    > >
    > > 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
    > >
    > >
    > >> Date: Tue, 22 Sep 2009 13:33:23 +0900
    > >> From:
    > >> Subject: How to detect what is running Ruby program?
    > >> To:
    > >>
    > >> 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 Smith
    > http://www.nomadicfun.co.uk
    >
    >
    >
    >
    Mason Kelsey, Sep 23, 2009
    #4
  5. Mason Kelsey

    Paul Smith Guest

    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 Kelsey <> wrote=
    :
    > 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! =A0It'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. =A0Why =

    can't
    > we all just get a lawn?
    >
    > No Sam
    > On Tue, Sep 22, 2009 at 6:10 AM, Paul Smith <> wro=

    te:
    >
    >> On Tue, Sep 22, 2009 at 5:44 AM, Jonathan Castello <>
    >> wrote:
    >> >
    >> > Perhaps try passing a command-line argument if you're running from Sci=

    TE,
    >> which your program can detect and act accordingly? Assuming there's no
    >> simpler way, that is.
    >> >
    >> > ~Jonathan
    >> >
    >> >
    >> >> Date: Tue, 22 Sep 2009 13:33:23 +0900
    >> >> From:
    >> >> Subject: How to detect what is running Ruby program?
    >> >> To:
    >> >>
    >> >> I work on a Windows platform and have two utiltities that I can execu=

    te
    >> a
    >> >> Ruby program from. =A0The IDE SciTE and the fxri- Instant Ruby

    >> Enlightenment,
    >> >> or so it says. =A0The input commands such as "gets" do not work in th=

    e
    >> SciTE
    >> >> utility but do in the fxri utility. =A0If 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. =A0Try 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 Smith
    >> http://www.nomadicfun.co.uk
    >>
    >>
    >>
    >>

    >




    --=20
    Paul Smith
    http://www.nomadicfun.co.uk

    Paul Smith, Sep 23, 2009
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    462
    Walter Roberson
    Aug 12, 2005
  2. Lorenzo Bettini
    Replies:
    3
    Views:
    613
    Lorenzo Bettini
    Sep 24, 2005
  3. Alexander Mahone

    Running a program (gperf) inside another C program

    Alexander Mahone, May 26, 2008, in forum: C Programming
    Replies:
    4
    Views:
    399
    Flash Gordon
    May 26, 2008
  4. Shadow123
    Replies:
    1
    Views:
    394
    Shadow123
    Jul 9, 2008
  5. James Coglan

    Detect when a Ruby program exits

    James Coglan, Jan 9, 2009, in forum: Ruby
    Replies:
    2
    Views:
    116
    James Coglan
    Jan 9, 2009
Loading...

Share This Page