2

I have a test that I'm running in Comma IDE from a Raku distro downloaded from github.

The tests passed last night. But after rebooting this morning, the test no longer passes. The test runs the raku on the machine. After some investigation, I discovered, that the binary was not getting found in the test:

say (run 'which', 'raku', :out).out.slurp; # outputs nothing

But if I run the test directly with prove6 from the command line, I get the full path to raku.

I'm using rakubrew.

I can easily fix this by adding the full path in the test, but I'm curious to know why Comma IDE sudddenly can't find the path to the raku binary.

UPDATE: I should also mention I reimported the proejct this morning and that caused some problems so I invalidated caches. So it may have been this and not the reboot that caused the problem. I'm unsure.

UPDATE 2: No surprise but

my $raku-path = (shell 'echo $PATH', :out).out.slurp;

yields only /usr/bin:/bin:/usr/sbin:/sbin

StevieD
  • 6,925
  • 2
  • 25
  • 45

1 Answers1

3

My best guess: in the situation where it worked, Comma was started from a shell where rakubrew had set up the environment. Then, after the reboot, Comma was started again, but from a shell where that was not the case.

Unless you choose to do otherwise, environment variables are passed on from parent process to child process. Comma inherits those from the process that starts it, and those are passed on to any Raku process that is spawned from Comma. Your options:

  1. Make your Raku program more robust by using $*EXECUTABLE instead of which raku (this variable holds the path to the currently executing Raku implementation)
  2. Make sure to start Comma from a shell where rakubrew has tweaked the path.
  3. Tweak the environment variables in the Run Configuration in Comma.
Jonathan Worthington
  • 29,104
  • 2
  • 97
  • 136
  • OK, thanks. Though I'm launching comma through the macos gui. Also, if I use Comma CT, 2022.04, everything works perfectly. And then after closing 2022.04 and reopening CP 2022.05, the test started working. But if I then try to test the whole project, I get an error: "No test source roots in the project." And then I right click on the 't/' folder offers no option to make it the root source for testing anymore. I'm inclined to think this has got to be a bug. 2022.05 has other major issues, too, compared to previous versions. – StevieD Jun 30 '22 at 17:21
  • OK, so I reimported project into CP. Tests now work. But then I try to open a file from the lib. Comma crashes each and every time I try. This has also been a frequent problem with the 2022.05 release. So I think I'm just going to use 2022.04 for now and hope the 2022.06 release fixes things. – StevieD Jun 30 '22 at 17:32
  • 1
    2022.05 is based on a newer version of the IntelliJ platform, which aside from the obvious compatibility breaks (which were identified and fixed before shipping) has come with a number of rather more insidious ones. :/ – Jonathan Worthington Jun 30 '22 at 20:13
  • Yeah, that's what I heard. Np. Thanks for making this. – StevieD Jun 30 '22 at 21:00