Shopify / intellij-shadowenv

MIT License
9 stars 9 forks source link

Error when running the project that contains a shadowenv dir #6

Open duduribeiro opened 11 months ago

duduribeiro commented 11 months ago

hey folks 👋

I have a problem. When I run the Rails project that I have that contains a .shadowenv.d dir with the following file: .shadowenv.d/100_default.lisp

(env/set "PORT" "3000")
(env/set "DATABASE_URL" "postgres://postgres:password@localhost:5432")
(env/prepend-to-pathlist "PATH" "./bin")

I receive the following error on RubyMine

Worker exited due to exception

java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "s" is null
    at java.base/java.lang.String.contains(String.java:2856)
    at com.shopify.shadowenv.products.rubymine.RubyMineRunConfigurationExtension.updateConfig(RubyMineRunConfigurationExtension.java:73)
    at com.shopify.shadowenv.products.rubymine.RubyMineRunConfigurationExtension.patchCommandLine(RubyMineRunConfigurationExtension.java:32)
    at com.shopify.shadowenv.products.rubymine.RubyMineRunConfigurationExtension.patchCommandLine(RubyMineRunConfigurationExtension.java:19)
    at com.intellij.execution.configuration.RunConfigurationExtensionBase.patchCommandLine(RunConfigurationExtensionBase.java:125)
    at com.intellij.execution.configuration.RunConfigurationExtensionsManager.patchCommandLine(RunConfigurationExtensionsManager.kt:183)
    at org.jetbrains.plugins.ruby.ruby.run.configuration.RubyAbstractCommandLineState.createCommandLineAndProcessHandler(RubyAbstractCommandLineState.java:163)
    at org.jetbrains.plugins.ruby.rails.run.configuration.server.RailsServerRunCommandLineState.createCommandLineAndProcessHandler(RailsServerRunCommandLineState.java:130)
    at org.jetbrains.plugins.ruby.ruby.run.configuration.RubyAbstractCommandLineState.startProcess(RubyAbstractCommandLineState.java:125)
    at org.jetbrains.plugins.ruby.ruby.run.configuration.RubyAbstractCommandLineState.execute(RubyAbstractCommandLineState.java:138)
    at org.jetbrains.plugins.ruby.ruby.run.configuration.RubyProgramRunner.doExecute(RubyProgramRunner.java:50)
    at org.jetbrains.plugins.ruby.ruby.run.configuration.RubyProgramRunner.lambda$execute$0(RubyProgramRunner.java:38)
    at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    at java.base/java.lang.Thread.run(Thread.java:833)

any tips on why this is happening?

I'm on Build #RM-233.8264.6, built on September 28, 2023

duduribeiro commented 11 months ago

if I set RUBY_ENV variable it works. But I think it can be optional. wdyt of

changing modules/products/rubymine/src/main/java/com/shopify/shadowenv/products/rubymine/RubyMineRunConfigurationExtension.java

from

 if (curName.contains(rv)) {

to

 if (curName == null || rv == null || curName.contains(rv)) {

?

this way we don't try to change ruby version if we don't specify it on env var