Well... On a unix system it says:
$ perl -V:sh sh='/bin/sh';
But that's exactly my point. This variable should not matter when using system() in the "argument array format". According to official perl documentation, when you use system() in the format:
system('command line with some args and special characters');
then this might involve calling a local shell. But when you call system() in the format:
system('executable', 'arg1', 'arg2', 'arg3');
then NO shell should be executed. Only the executable should be run getting the args as they are specified.

As far as I know, on Unix the C-library function 'execv' gets called for this. And it works perfectly well. Even if any of the argN contains special characters or shell metacharacters.

Now... I know that Windows is not Unix, and that on Windows there is no such thing as 'execv'. But even then, I would expect that something similar exists in the OS kernel, and that the Perl implementors (I mean: creators of Perl packages for Windows) are able to run the program, that I specify in the system() call, and pass it my arguments exactly as I specify them at their exact specified positions.

So I'm wondering... Is system() implemented badly on windows ? Or is there really no way in Windows OS to achieve the same behaviour as on Unix (i.e. to make system() simply execute the executable and pass it a stack of arguments) ??


In reply to Re^4: system() implementation on Windows (again) by Anonymous Monk
in thread system() implementation on Windows (again) by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.