Reputation: 30765
I have noticed, that Scala doesn't always execute instructions in order. For example, if you have the following instructions.
var a = command1.!
var b = command2.!
The second instruction may be executed before the first one because it doesn't have any dependency on that instruction. So, my question is, how can I force the second instruction to be executed after the first instruction.
Upvotes: 0
Views: 536
Reputation: 39577
Answering the question, How do I compose ProcessBuilder?, the doc says:
Two existing ProcessBuilder can be combined in the following ways:
They can be executed in parallel, with the output of the first being fed as input to the second, like Unix pipes. This is achieved with the #| method.
They can be executed in sequence, with the second starting as soon as the first ends. This is done by the ### method.
The execution of the second one can be conditioned by the return code (exit status) of the first, either only when it's zero, or only when it's not zero. The methods #&& and #|| accomplish these tasks.
Upvotes: 1