~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/console/service.py

  • Committer: William Grant
  • Date: 2010-02-26 06:33:35 UTC
  • Revision ID: grantw@unimelb.edu.au-20100226063335-25ka31up8cegwaiz
ivle.interpret.execute_raw now sets a clean environment, in particular with HOME set correctly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
 
88
88
        msg = {'cmd':kind, 'text':text}
89
89
        try:
90
 
            json_response = ivle.chat.chat(host, port, msg, magic,decode=False)
91
 
 
92
 
            # Snoop the response from python-console to check that it's valid
93
90
            try:
 
91
                json_response = ivle.chat.chat(host, port, msg, magic,decode=False)
 
92
                # Snoop the response from python-console to check that it's valid
94
93
                response = cjson.decode(json_response)
95
 
            except cjson.DecodeError:
 
94
            except (cjson.DecodeError, ivle.chat.ProtocolError):
96
95
                # Could not decode the reply from the python-console server
97
96
                response = {"terminate":
98
 
                    "Communication to console process lost"}
 
97
                    "Communication lost"}
99
98
            if "terminate" in response:
100
99
                response = restart_console(req.config, uid, jail_path,
101
100
                    working_dir, response["terminate"])
104
103
                # Timeout: Restart the session
105
104
                response = restart_console(req.config, uid, jail_path,
106
105
                    working_dir,
107
 
                    "The IVLE console has timed out due to inactivity")
 
106
                    "Timed out due to inactivity")
108
107
            elif enumber == errno.ECONNRESET:
109
108
                # Communication issue: Restart the session
110
109
                response = restart_console(req.config, uid, jail_path,
111
110
                    working_dir,
112
 
                    "Connection with the console has been reset")
 
111
                    "Connection reset")
113
112
            else:
114
113
                # Some other error - probably serious
115
114
                raise socket.error, (enumber, estring)