Cats-Effect: Cancel Scala Process on Timeout

Alexey Novakov published on

4 min, 735 words

Sometimes Scala developer needs to call external program, which is running outside of the JVM. In this case, we use scala.sys.process package. Process package has bunch of functions to spin up new processes, consume their outputs and errors. Also, spawned process can be stopped. Usually, we run external programs for a short period of time to make some side-effect. Then, we analyse its exit code to apply some error handling logic in our main Scala program. It worth to say that process API is blocking execution thread, when we are waiting for its completion. To summarise, Scala developer wants to do the following:

Read More

Categories: scala