Commit d4830a5a authored by Holger Brandl's avatar Holger Brandl
Browse files

use temp directory when spinning snippets

parent 4b155292
......@@ -55,7 +55,7 @@ commandArgs <- function(trailingOnly = FALSE){ return(as.character(spin_opts$quo
#print("end args")
## todo use temp-file-name here to allow for cocurring spin.R in same directory
## todo use temp-file-name here to allow for cocurring spin.R in same directory --> pointless because results would be overwritten
## copy R-script to working directory and forget about the original one
#file.copy(r_script, basename(r_script))
system(paste("cat ", r_script," | grep -Ev '^#+$' | grep -Fv '#!/usr/bin/env Rscript' >", basename(r_script)))
......
......@@ -18,7 +18,7 @@ spinsnip(){
fi
reportName=$1
tmpR=$(echo $reportName | tr " " "_").R
tmpR=$(mktemp -d)/$(echo $reportName | tr " " "_").R
## http://stackoverflow.com/questions/11454343/pipe-output-to-bash-function
cat | sed 's/#>/#'"'"'/g' > $tmpR
......@@ -28,7 +28,8 @@ spinsnip(){
shift
spinr $tmpR $*
rm $tmpR
# rm -r $(dirname $tmpR)
rm ${tmpR}
}
export -f spinsnip
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment