[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Executing Files (without shell

fedzor

12/13/2007 11:27:00 PM

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.



2 Answers

Ken Bloom

12/14/2007 12:16:00 AM

0

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

--
Ken (Chanoch) Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology.
http://www.iit.edu...

fedzor

12/14/2007 12:58:00 AM

0


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

> 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

Guarenteed? Are you certain? I just want to be sure....



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