Stack Exchange
No signature of method: java.lang.String.waitFor() is applicable for argument types: () values: []
For some reason I've started getting this exception today:
19/08/28 17:33:01.739 ERROR: No signature of method: java.lang.String.waitFor() is applicable for argument types: () values: []
Possible solutions: wait(), wait(long), wait(long, int), with(groovy.lang.Closure), notify()
groovy.lang.MissingMethodException: No signature of method: java.lang.String.waitFor() is applicable for argument types: () values: []
Possible solutions: wait(), wait(long), wait(long, int), with(groovy.lang.Closure), notify()
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
    at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
    at jiraActionExecutor.addIssueKeyToIncidentDetails(jiraActionExecutor.groovy:132)
    at jiraActionExecutor$addIssueKeyToIncidentDetails.callCurrent(Unknown Source)
    at jiraActionExecutor.run(jiraActionExecutor.groovy:104)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1054)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:884)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:704)
    at groovy.lang.GroovyObjectSupport.invokeMethod(GroovyObjectSupport.java:44)
    at groovy.lang.Script.invokeMethod(Script.java:78)
    at com.ifountain.opsgenie.client.script.GroovyCompiledScriptEngine.doRun(GroovyCompiledScriptEngine.java:21)
    at com.ifountain.opsgenie.client.script.AbstractCompiledScriptEngine.runScript(AbstractCompiledScriptEngine.java:30)
    at com.ifountain.opsgenie.client.script.ScriptManager.runScript(ScriptManager.java:62)
    at com.ifountain.opsgenie.client.marid.alert.AlertActionUtils.executeActionScript(AlertActionUtils.java:43)
    at com.ifountain.opsgenie.client.marid.alert.PubnubAlertActionListener.processMessage(PubnubAlertActionListener.java:163)
    at com.ifountain.opsgenie.client.marid.alert.PubnubAlertActionListener$2$1$1.run(PubnubAlertActionListener.java:99)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:835)

I can't find anything indicating what the appropriate way to use this method is. Here's the code it's breaking on though:
if (responseBody != null) {
        process = [ 'bash', '-c', "curl -X POST \
                                    -H \"Content-Type: application/json\" \
                                    -H \"Authorization: GenieKey 8e927cdc-aa94\" \
                                    -d '${json}' \
                                    https://api.opsgenie.com/v1/incidents/${incidentId}/details?identifierType=id" \
                ].execute().text
        process.waitFor()
        logger.debug(process.err.text)
        logger.debug(process.text)

What am I doing wrong?

Replace .execute().text with .execute()

you should use standard JVM libraries for such tasks like groovy's HttpBuilder instead of process execution.

In case someone comes here with the same question, I just commented out the waitFor() line and it worked.
