I\'m working with the Scala scala.sys.process library.
scala.sys.process
I know that I can capture the exit code with ! and the output with !!
!
!!
You can specify an output stream that catches the text:
import sys.process._ val os = new java.io.ByteArrayOutputStream val code = ("volname" #> os).! os.close() val opt = if (code == 0) Some(os.toString("UTF-8")) else None