Executing Files (without shell)

Once again, a similarly themed question from me:

Is it possible (without syscall ) to execute a file without using a
shell?

Thanks
_______________________________|

  • Ari
    I just bought another case of RockStar. Expect architectural changes.

On Thu, 13 Dec 2007 18:27:10 -0500, thefed wrote:

Once again, a similarly themed question from me:

Is it possible (without syscall ) to execute a file without using a
shell?

Calling Kernel#system will sometimes fork a shell if you pass it
something complicated like pipelines, but you can be guaranteed that it
won’t spawn a shell (it will execve the binary directly) if you pass the
binary name and the command line arguments as separate parameters. (E.g.
system(“echo”,“hello”,“world”) Likewise if you’re running a binary that
takes no parameters so there’s only one string being passed as a
parameter.

–Ken

On Dec 13, 2007, at 7:40 PM, Ken B. wrote:

won’t spawn a shell
Guarenteed? Are you certain? I just want to be sure…

-------------------------------------------------------|
~ Ari
crap my sig won’t fit

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs