Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add sandbox

  • Loading branch information...
commit 0fe1870630402deb9ae557681706f56b3ac438ce 1 parent d7bb363
@halida authored
Showing with 17 additions and 1 deletion.
  1. +17 −1 sandbox
View
18 sandbox
@@ -1,8 +1,20 @@
#!/Users/halida/.rvm/bin/ruby
+SANDBOX = false
+
require 'json'
require 'tempfile'
+def sandbox_run cmd
+ require 'rubypython'
+ RubyPython.start
+ RubyPython.import("sandbox")
+
+ s = sandbox.Sandbox(cmd)
+ s.run()
+ s.probe().rubify
+end
+
def get_data
filename = ARGV[0]
data = JSON.load File.read(filename)
@@ -33,7 +45,11 @@ def process
raise "language not exists: #{data['language']}"
end
- error = `#{cmd}`
+ if SANDBOX
+ error = sandbox_run cmd
+ else
+ error = `#{cmd}`
+ end
output = File.read(output_filename)
Please sign in to comment.
Something went wrong with that request. Please try again.