test/test.rb in procemon-1.2.1 vs test/test.rb in procemon-2.0.0
- old
+ new
@@ -1,5 +1,31 @@
# Require Gemfile gems
-require_relative "../lib/procemon"
+def safe_eval(*args)
-puts( {:hello=> "world",:world => "hello"}.map_hash{|k,v| [ k , 123] })
\ No newline at end of file
+ # require 'stringio'
+ # old_values = [$stderr,$VERBOSE]
+ # $stderr = StringIO.new
+ # $VERBOSE= false
+
+ ::Thread.new{
+
+ safe_ok= false
+ begin
+ $SAFE= 3
+ safe_ok= true
+ rescue
+ end
+ if safe_ok
+ eval(*args)
+ end
+
+ }.value
+
+ensure
+ # $stderr = old_values[0]
+ # $VERBOSE= old_values[1]
+
+end
+
+
+safe_eval " puts('hello world'); Process.exit! "