develooper Front page | perl.perl6.users | Postings from December 2022

Re: Raku opens a notepad when executing a .bat

Thread Previous | Thread Next
From:
ToddAndMargo via perl6-users
Date:
December 6, 2022 11:13
Subject:
Re: Raku opens a notepad when executing a .bat
Message ID:
2bdeb76e-0e03-84d7-db1d-9d1987e0b233@zoho.com
On 12/6/22 02:40, Ralph Mellor wrote:
> Please confirm that:
> 
> * Entering `ls` at the command line prompt does what it says
>    on the tin, it does not open notepad.
> 
> * A Raku program that consists of the single line `qqx 'ls'` does
>    what it says on the tin, and does not open notepad.
> 
> If those are true, then this code:
> 
> ```
> use lib '.'; use NativeWinUtils :RunCmd; say RunCmd(Q[ls]);
> ```
> is NOT running the code you showed starting `sub RunCmd`.
> 
> --
> raiph
> 
> On Tue, Dec 6, 2022 at 9:44 AM ToddAndMargo via perl6-users
> <perl6-users@perl.org> wrote:
>>
>> Hi All,
>>
>> Windows Pro Chromebook Edition 22H2  (W11)
>> raku -v  Welcome to RakudoΓäó v2022.07.
>>
>> When ever I run the following, it opens
>> a Notepad with the text of the calling
>> raku program.
>>
>> raku -e "use lib '.'; use NativeWinUtils :RunCmd; say RunCmd(Q[ls]);"
>>
>> This is RunCmd
>>
>> sub RunCmd( Str $CommandStr, Bool $EchoOff = False ) returns Str is
>> export( :RunCmd )  {
>>      my $PathIAm          = $?FILE;
>>      my Str $BatFile = $PathIAm ~ ".bat";
>>      # print "$BatFile\n";
>>      my Str $RtnStr;
>>      my Str $CmdStr = "";
>>
>>      if $EchoOff  { $CmdStr = Q[@echo off] ~ "\n"; }
>>      $CmdStr = $CmdStr ~ $CommandStr ~ "\n";
>>      # print "$CmdStr";
>>
>>      spurt( $BatFile, $CmdStr );
>>      $RtnStr = qqx { $BatFile };
>>      # print "$RtnStr\n";
>> }
>>
>>
>> It is the qqx command (it runs the created .bat file)
>> that opens the notepad.
>>
>> The .bat file, which I leave on the disk,
>> runs fine manually.
>>
>> And I did this to myself.  I had a pop up that
>> asked me what to do with something and I must
>> have clicked on it by accident.
>>
>> -T

 >raku -e "use lib '.'; use NativeWinUtils :RunCmd; say RunCmd(Q[ls]);"

 >raku -e "use lib '.'; use NativeWinUtils :RunCmd; say RunCmd(Q[echo 
12345]);"

 >raku -e "use lib '.'; use NativeWinUtils :RunCmd; say RunCmd(Q[where 
raku]);"

 >raku -e "use lib '.'; use NativeWinUtils :RunCmd; say RunCmd(Q[raku 
-v], True);"

Anything opens notepad with the source code to
NativeWinUtils.pm6.

What in the world did I do???






-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About