Skip to content

Instantly share code, notes, and snippets.

@pestilence669
Created July 9, 2016 23:09
Show Gist options
  • Save pestilence669/98ee576a98561486bd719d630c9b0d77 to your computer and use it in GitHub Desktop.
Save pestilence669/98ee576a98561486bd719d630c9b0d77 to your computer and use it in GitHub Desktop.
Scala shell script template
#!/bin/sh
exec scala "$0" "$@"
!#
// vim: set ts=2 sw=2 noet:
// http://alvinalexander.com/scala/how-to-handle-stdout-stderr-external-system-commands-scala
import sys.process._
val stdout = new StringBuilder
val stderr = new StringBuilder
val status = "ls -la" ! ProcessLogger(stdout append _, stderr append _)
println(status)
println("stdout: " + stdout)
println("stderr: " + stderr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment