[Cascavel-pm] system

Alceu R. de Freitas Jr. glasswalk3r em yahoo.com.br
Terça Novembro 28 12:48:40 PST 2006


--- Nilson Santos Figueiredo Junior <acid06 em gmail.com>
escreveu:

> On 11/28/06, Alceu R. de Freitas Jr.
> <glasswalk3r em yahoo.com.br> wrote:
> > Da forma que está sendo usado, o system não vai
> chamar
> > o shell nunca.
> 
> system('dir', @args) chama o shell.
> system('programaquenaoexiste.exe', @args) também
> chama.

Eu resolvi refrescar minha memória:

system PROGRAM LIST

Does exactly the same thing as "exec LIST", except
that a fork
is done first, and the parent process waits for the
child
process to complete. Note that argument processing
varies
depending on the number of arguments. If there is more
than one
argument in LIST, or if LIST is an array with more
than one
value, starts the program given by the first element
of the list
with arguments given by the rest of the list. If there
is only
one scalar argument, the argument is checked for shell
metacharacters, and if there are any, the entire
argument is
passed to the system's command shell for parsing (this
is
"/bin/sh -c" on Unix platforms, but varies on other
platforms).
If there are no shell metacharacters in the argument,
it is
split into words and passed directly to "execvp",
which is more
efficient.

O livro do Camelo fala mais alguma coisa sobre isso.

> O fato é que, da forma como ele está usando, não era
> pra estar chamando.

Essa é a parte interessante: ele reclama que não
encontra cmd.exe, que é justamente o shell.
Sinistro...

[]'s


Alceu Rodrigues de Freitas Junior
--------------------------------------
glasswalk3r em yahoo.com.br
http://www.imortais.cjb.net
-----------------------------------------------------------------------
A well-used door needs no oil on its hinges.
A swift-flowing stream does not grow stagnant.
Neither sound nor thoughts can travel through a vacuum.
Software rots if not used.
These are great mysteries -- The Tao Of Programming, 5.1


		
_______________________________________________________ 
Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora! 
http://br.mobile.yahoo.com/mailalertas/ 
 



Mais detalhes sobre a lista de discussão Cascavel-pm