Skip to content

Commit

Permalink
Use mktemp to create workspace directory
Browse files Browse the repository at this point in the history
mktemp is a better idea for security, as well as enabling users to
specify a different directory using the TMPDIR environment variable,
which is useful if /tmp is a small tmpfs.

Also fix a bug where the first few log messages were failing as the
workspace directory wasn't been created early enough.
  • Loading branch information
nickjwhite committed Sep 10, 2015
1 parent c0133ec commit de789ac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions training/tesstrain.sh
Expand Up @@ -49,11 +49,8 @@ source `dirname $0`/tesstrain_utils.sh
ARGV=("$@")
parse_flags

tlog "\n=== Starting training for language '${LANG_CODE}'"

tlog "Cleaning workspace directory ${TRAINING_DIR}..."
mkdir -p ${TRAINING_DIR}
rm -fr ${TRAINING_DIR}/*
tlog "\n=== Starting training for language '${LANG_CODE}'"

source `dirname $0`/language-specific.sh
set_lang_specific_parameters ${LANG_CODE}
Expand Down
2 changes: 1 addition & 1 deletion training/tesstrain_utils.sh
Expand Up @@ -25,7 +25,7 @@ OUTPUT_DIR="/tmp/tesstrain/tessdata"
OVERWRITE=0
RUN_SHAPE_CLUSTERING=0
EXTRACT_FONT_PROPERTIES=1
WORKSPACE_DIR="/tmp/tesstrain"
WORKSPACE_DIR=`mktemp -d`
EXPOSURES=0

# Logging helper functions.
Expand Down

0 comments on commit de789ac

Please sign in to comment.