app/controllers/preprocessor/python/python_preprocessor.rb
def commands_for_vm
    [{:write_file => {:filename => @filename, :content => @code}},
    {:execute => {:command => "#{VM_PYTHON} -c \"compile(open('#{@filename}').read(), '', 'exec')\" && echo success",
                  :stdout => 'syntaxchecksuccess',
                  :stderr => 'syntaxcheckfail'}}]
    # in this case execution only triggers the initial syntax check, the rest is handled
    # in postprocess_print
  end
# Commands to be sent to the VM to check whether there are syntax errors in the code. The
# Python call is more complex than one might anticipate since we need to prevent Python
# from trying to create __pycache__ folders, which the user that executes this code does
# not necessarily have permission to do.
Commands to be sent to the VM to check whether there are syntax errors in the code. The
Python call is more complex than one might anticipate since we need to prevent Python
from trying to create __pycache__ folders, which the user that executes this code does
not necessarily have permission to do.
Commands to be sent to the VM to check whether there are syntax errors in the code . The Python call is more complex than one might anticipate since we need to prevent Python from trying to create __pycache__ folders which the user that executes this code does not necessarily have permission to do .
def commands_for_vm
    [{:write_file => {:filename => @filename, :content => @code}},
    {:execute => {:command => "#{VM_PYTHON} -c \"compile(open('#{@filename}').read(), '', 'exec')\" && echo success",
                  :stdout => 'syntaxchecksuccess',
                  :stderr => 'syntaxcheckfail'}}]
  end
def commands_for_vm [ { :write_file => { :filename => @filename , :content => @code } } , { :execute => { :command => "#{VM_PYTHON} -c \"compile(open('#{@filename}').read(), '', 'exec')\" && echo success" , :stdout => 'syntaxchecksuccess' , :stderr => 'syntaxcheckfail' } } ] end
Commands to be sent to the VM to check whether there are syntax errors in the code.
Commands to be sent to the VM to check whether there are syntax errors in the code .
# in this case execution only triggers the initial syntax check, the rest is handled # in postprocess_print