Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: [Raku] Asterisk on DOS command line

by jcb (Parson)
on Feb 11, 2021 at 02:52 UTC ( [id://11128212]=note: print w/replies, xml ) Need Help??


in reply to [Raku] Asterisk on DOS command line

The problem here is Windows. Unlike POSIX systems, which pass an argument vector containing strings, WinDOS passes only a "command tail" string into the new process. The C runtime library then interprets that string to find argc and build argv to pass to main.

Wildcard expansion (or lack thereof) on Windows is therefore a function of the runtime libraries perl and raku are linked against, but the CMD shell apparently does strip some quotes, just because it was not confusing enough. Try "'*'", which also may or may not work.

Replies are listed 'Best First'.
Re^2: [Raku] Asterisk on DOS command line -- C runtime argc argv
by Discipulus (Canon) on Feb 11, 2021 at 07:56 UTC
    Hello jcb,

    very interesting indeed! This is the first time I read something like this on the argument and you will pardon my ignorance on the whole matter.

    > The C runtime library then interprets that string to find argc and build argv to pass to main

    Given your precious hint I discovered perlwin32#Using-perl-from-the-command-line documentation. But let me see if I understood it right.

    The above document says:

    > It is particularly important to note that neither the shell nor the C runtime do any wildcard expansions of command-line arguments

    and the above sounds different from your statement "Wildcard expansion ... is therefore a function of the runtime libraries perl and raku are linked against".

    But what you said seems confirmed by some experiment: yesterday I chatted a bit on the #raku channel on irc and someone said they noticed opposed behaviour on windows, with and without expansion, probably due to different build of the raku itself, rakubrew iirc.

    So the above document (related to perl but I suppose is valid for raku too) seems to be incorrect in the sense that sometimes perl or raku can be built using a C runtime library that effectively does the expansion? Can be this the case of the OP?

    If the above is true then can be perl built on windows using a C runtime library that is able to expand the * char as done by more smart shells? This would be a nice improvement.

    Thanks for your contribution

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re^2: [Raku] Asterisk on DOS command line
by LanX (Saint) on Feb 11, 2021 at 03:21 UTC
    > But the CMD shell apparently does strip some quotes

    I don't have Raku so I tested against Perl.

    Looks like only doublequotes are stripped if not escaped.

    D:\tmp\pm>perl -e"print @ARGV" * * D:\tmp\pm>perl -e"print @ARGV" '*' '*' D:\tmp\pm>perl -e"print @ARGV" "'*'" '*' D:\tmp\pm>perl -e"print @ARGV" "*" * D:\tmp\pm>perl -e"print @ARGV" \* \* D:\tmp\pm>perl -e"print @ARGV" \"*\" "*" D:\tmp\pm>

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11128212]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-19 06:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found