Process code 127 when installing plugin, but works when debugging

Answered

Hi, so issue is I have plugin which is running process with java, running on mac: 

e.g. 

var process = new ProcessBuilder().command(
                "/bin/sh",
                "-c",
                "kubectl get pods"
                )
            ).start();
            //added to catch why plugin was not working
int x = process.waitFor();

       if(x != 0) {
           MyNotifier.notifyError(e.getProject(), Integer.toString(x), "Output: ");//127 code
         }           
            

Which is working fine if I will debug my plugin, but when I build plugin `zip` and install it, my process waitFor() method starts returning 127 code error, which I understood is command not found. 

Any idea why is that happening ? I was like 100% sure if in debug mode all works after installing it'll also be working, but seems not.  

It's not related to kubectl but for all commands, was also trying to run: 

/bin/bash -c whoami and that also return 127 

UPD: but if I type only `whoami` it'll return my user

0
1 comment

Hi Alex,

I guess the reason is that PATH environment variable that contains the path to kubectl command when it is run in sandbox mode, and doesn't contain it when you run the actual IDE. You can verify it by printing System.getenv("PATH") before running the process.

0

Please sign in to leave a comment.