Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble using the cro command-line tool as documented

Tags:

windows

raku

cro

I'm running Rakudo Star 2019.03.1 on Windows 7, Cro was installed by zef. Following the Getting Started section on the Cro website, the following should work:

The cro stub command generates stub services for you, to get started more quickly and with better defaults. Here we use it to create a simple HTTP service, with ID hello and in the hello directory:

cro stub http hello hello

...which actually does work, it generates a lot of files for the project including the .cro.yml file, which I assume is the central description file for the service. But if I try to follow the docs and run cro run (from inside the hello directory, I assumed):

The cro run command will start your service (and automatically restart the service if you change a file):

cro run

...the service isn't started but cro errors out:

A react block:
  in sub run-services at C:\rakudo\share\perl6\site\sources\709F4B18755ADE6922C88B8C44A0930A5DDD77C9 (Cro::Tools::CLI) line 227
  in sub MAIN at C:\rakudo\share\perl6\site\sources\709F4B18755ADE6922C88B8C44A0930A5DDD77C9 (Cro::Tools::CLI) line 199
  in block <unit> at C:\rakudo\share\perl6\site\resources\C1E87B0F084684C12CD87240AE4C12E746174570 line 1
  in sub MAIN at C:\rakudo\share\perl6\site\bin\cro line 3
  in block <unit> at C:\rakudo\share\perl6\site\bin\cro line 1

Died because of the exception:
    no such file or directory
      in any  at C:\rakudo\share/perl6/runtime/CORE.d.setting.moarvm line 1
      in sub run-services at C:\rakudo\share\perl6\site\sources\709F4B18755ADE6922C88B8C44A0930A5DDD77C9 (Cro::Tools::CLI) line 227
      in sub MAIN at C:\rakudo\share\perl6\site\sources\709F4B18755ADE6922C88B8C44A0930A5DDD77C9 (Cro::Tools::CLI) line 199
      in block <unit> at C:\rakudo\share\perl6\site\resources\C1E87B0F084684C12CD87240AE4C12E746174570 line 1
      in sub MAIN at C:\rakudo\share\perl6\site\bin\cro line 3
      in block <unit> at C:\rakudo\share\perl6\site\bin\cro line 1

This error message is unfortunately not speaking to me. What do I miss?

like image 566
zb226 Avatar asked Jul 15 '19 22:07

zb226


1 Answers

Update

Somehow I missed this Cro github issue yesterday when googling, which is precisely what my problem was. I backlinked this question+answer in the github issue. A fix has since been merged and will be part of the next release of Cro. Props for the quick response everybody!


Original Answer

This could be resolved with the help of timotimo (Thanks!), who

  • suggested Cro::Tools::Runner calls perl6 instead of perl6.bat which is needed for Windows.
  • pointed me to this answer which has the important bits of information regarding changing code in zef-installed modules.

So I headed over to %USERPROFILE%\.zef\store\cro-0.8.1.tar.gz\cro-0.8.1\lib\Cro\Tools and patched the executable name in line 269 of Runner.pm6. Then I went back up to %USERPROFILE%\.zef\store\cro-0.8.1.tar.gz\cro-0.8.1 and recompiled and installed the module with the following command (note the --/test to skip the tests, which take a lot of time):

C:\...\.zef\store\cro-0.8.1.tar.gz\cro-0.8.1>zef install . --force-install --/test --verbose
The following local path candidates are already installed: .
===> Installing: cro:ver<0.8.1>
===> Install [OK] for cro:ver<0.8.1>

1 bin/ script [cro] installed to:
C:\rakudo\share\perl6\site\bin

Now, cro run spews what I believe to be ANSI codes at me, but it is working :)

C:\ws\perl6\hello>cro run
←[1;32mÔûÂ Starting hello (hello)←[0m
←[32m­ƒöî Endpoint HTTP will be at http://localhost:20000/←[0m
←[32m­ƒôô hello ←[0mListening at http://localhost:20000
like image 189
zb226 Avatar answered Nov 04 '22 03:11

zb226