Permalink
Browse files

+ Added MOVE_TIMEOUT env var for ruby_parse_extract_error to move slo…

…w files to a sibling directory

[git-p4: depot-paths = "//src/ruby_parser/dev/": change = 8068]
  • Loading branch information...
1 parent 3274b32 commit 19778213cbeefe2594a411d11606917b7a8c3597 @zenspider zenspider committed Dec 18, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 bin/ruby_parse_extract_error
@@ -4,11 +4,14 @@ $d ||= false
$d ||= ENV["DELETE"]
$t ||= false
$t ||= ENV["DELETE_TIMEOUT"]
+$m ||= false
+$m ||= ENV["MOVE_TIMEOUT"]
$q ||= false
$q ||= ENV["QUIET"]
require 'rubygems'
require 'ruby_parser'
+require 'fileutils'
ARGV.push "-" if ARGV.empty?
@@ -96,7 +99,14 @@ def process file
rescue Timeout::Error
$exit = 1
warn "TIMEOUT parsing #{file}. Skipping."
- File.unlink file if $t
+
+ if $m then
+ dir = File.join $m, File.dirname(file)
+ FileUtils.mkdir_p dir
+ FileUtils.move file, dir
+ elsif $t then
+ File.unlink file
+ end
rescue StandardError, SyntaxError, Racc::ParseError => e
$exit = 1
warn ""

0 comments on commit 1977821

Please sign in to comment.