Skip to content

Instantly share code, notes, and snippets.

@shogonir
Created October 18, 2016 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shogonir/ca74a5799e52d1a3ab44136626deb852 to your computer and use it in GitHub Desktop.
Save shogonir/ca74a5799e52d1a3ab44136626deb852 to your computer and use it in GitHub Desktop.
package process
import scala.sys.process._
/**
* Created by shogo on 2016/10/19.
*/
object ProcessSample {
def main(args: Array[String]) {
try {
val output = Process("datadog-agent status") !!;
// exit zero status code
// datadog-agent is installed
println(output)
} catch {
case e: Throwable =>
println("err, " + e.getMessage)
// exit non zero status code
// command not found
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment