Running an executable local file with a Ruby script??

Discussion in 'Ruby' started by Thomas Luedeke, Aug 24, 2008.

  1. I'm having a lot of problems just running an executable local file with
    a Ruby script. I go to the directory with the file (call the executable
    file 'mkplots'), then try to run that file.

    I've tried all sorts of system and back-quoted commands, and nothing
    works. If I go to the UNIX command line and simply type the file name,
    it runs fine.

    What am I doing wrong?? Why doesn't the following command work:

    system( "mkplots" )

    --- or ---

    `mkplots`
    --
    Posted via http://www.ruby-forum.com/.
     
    Thomas Luedeke, Aug 24, 2008
    #1
    1. Advertising

  2. Thomas Luedeke <> writes:

    > I'm having a lot of problems just running an executable local file with
    > a Ruby script. I go to the directory with the file (call the executable
    > file 'mkplots'), then try to run that file.
    >
    > I've tried all sorts of system and back-quoted commands, and nothing
    > works. If I go to the UNIX command line and simply type the file name,
    > it runs fine.
    >
    > What am I doing wrong?? Why doesn't the following command work:
    >
    > system( "mkplots" )


    Is the current path in your PATH environment variable? If not, use

    system( "./mkplots" )

    --
    Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
     
    Joost Diepenmaat, Aug 24, 2008
    #2
    1. Advertising

  3. Joost Diepenmaat wrote:
    > Thomas Luedeke <> writes:
    >
    >> system( "mkplots" )

    > Is the current path in your PATH environment variable? If not, use
    >
    > system( "./mkplots" )



    I've tried that. I don't get any errors, but it also doesn't produce
    any output (like it does if I use the command line).
    --
    Posted via http://www.ruby-forum.com/.
     
    Thomas Luedeke, Aug 24, 2008
    #3
  4. Thomas Luedeke

    Dave Bass Guest

    Replace ./mkplots with a very simple executable (or script) which does
    something like writing to a file, including any error messages sent to
    stderr. Temporarily (!) give it maximal permissions, before reducing it
    to the same permissions as mkplots.

    This will allow you to see whether the executable is actually being
    executed or not and whether any errors are being generated. In my
    experience there are often problems with permissions, especially if the
    script is being run by a web server.



    --
    Posted via http://www.ruby-forum.com/.
     
    Dave Bass, Aug 24, 2008
    #4
  5. Dave Bass wrote:
    > Replace ./mkplots with a very simple executable (or script) which does
    > something like writing to a file, including any error messages sent to
    > stderr. Temporarily (!) give it maximal permissions, before reducing it
    > to the same permissions as mkplots.
    >
    > This will allow you to see whether the executable is actually being
    > executed or not and whether any errors are being generated. In my
    > experience there are often problems with permissions, especially if the
    > script is being run by a web server.



    This is kind of dumb (and certainly not 'The Ruby Way', but I got it to
    work with this workaround.

    (1) Create a little Korn shell file (save as make_plots.sh, change
    permissions with a `chmod +x make_plots.sg` ):

    <i>#! /bin/ksh</i>
    <i>mkplots</i>

    (2) Run it with the following command in Ruby

    system( "make_plots.sh" )



    However, this really offends me to have to do this, so any further ideas
    are welcome....
    --
    Posted via http://www.ruby-forum.com/.
     
    Thomas Luedeke, Aug 24, 2008
    #5
  6. [Note: parts of this message were removed to make it a legal post.]

    I am not familiar enough with calls in Ruby to system in Linux at this
    moment, but in Windows, I was recently doing this, and had to use something
    like this: system"call command"

    If I simply did system"command" it did not operate like I expected.


    On Sun, Aug 24, 2008 at 3:58 PM, Thomas Luedeke <>wrote:

    > Dave Bass wrote:
    > > Replace ./mkplots with a very simple executable (or script) which does
    > > something like writing to a file, including any error messages sent to
    > > stderr. Temporarily (!) give it maximal permissions, before reducing it
    > > to the same permissions as mkplots.
    > >
    > > This will allow you to see whether the executable is actually being
    > > executed or not and whether any errors are being generated. In my
    > > experience there are often problems with permissions, especially if the
    > > script is being run by a web server.

    >
    >
    > This is kind of dumb (and certainly not 'The Ruby Way', but I got it to
    > work with this workaround.
    >
    > (1) Create a little Korn shell file (save as make_plots.sh, change
    > permissions with a `chmod +x make_plots.sg` ):
    >
    > <i>#! /bin/ksh</i>
    > <i>mkplots</i>
    >
    > (2) Run it with the following command in Ruby
    >
    > system( "make_plots.sh" )
    >
    >
    >
    > However, this really offends me to have to do this, so any further ideas
    > are welcome....
    > --
    > Posted via http://www.ruby-forum.com/.
    >
    >
     
    Victor H. Goff III, Aug 24, 2008
    #6
    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. =?Utf-8?B?WVNVVA==?=

    Access local port or Running local exe file

    =?Utf-8?B?WVNVVA==?=, Jan 14, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    519
    =?Utf-8?B?WVNVVA==?=
    Jan 14, 2006
  2. Replies:
    15
    Views:
    491
    Dave Thompson
    Aug 21, 2006
  3. pratap
    Replies:
    20
    Views:
    762
    Flash Gordon
    Mar 7, 2007
  4. Jason Cavett
    Replies:
    8
    Views:
    623
    Sanjay
    May 16, 2007
  5. Replies:
    0
    Views:
    444
Loading...

Share This Page