Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect stdout from SBT run to file

Inspired by the examples on the SBT github page, I'm trying to redirect the stdout produced from a run in SBT's interactive mode to a file.

Here's my failed attempt:

> run #> file('/Users/dsg/temp/temp.txt') !

I've tried both with and without the ! at the end. I've tried both single and double quotes. Nothing works -- it just behaves as if the #> file(... is omitted, things only get printed to stdout, no file is created.

like image 759
dsg Avatar asked Jan 24 '12 23:01

dsg


1 Answers

I'm not an SBT expert, but this doesn't seem to be the correct feature.

> run is interpreting everything after it as file arguments. #> seems to be part of the sbt library, for use inside of your project sbt files, not at their prompt.

Getting around this, I exit sbt, and use my external shell to do this:

$ sbt "run" > run_output.txt
like image 127
John Foley Avatar answered Sep 22 '22 09:09

John Foley