Fix shell name in argv[0]

This commit is contained in:
Florian Mounier
2014-02-28 12:20:41 +01:00
parent 9351fdceec
commit 0cbb4b2afc
2 changed files with 4 additions and 7 deletions

View File

@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__version__ = '1.2.0'
__version__ = '1.2.1'
import os

View File

@@ -105,26 +105,23 @@ class TermWebSocket(Route, tornado.websocket.WebSocketHandler):
except:
pass
shell = tornado.options.options.shell or self.callee.shell
env = os.environ
env.update(self.socket.env)
env["TERM"] = "xterm-256color"
env["COLORTERM"] = "butterfly"
env["HOME"] = self.callee.dir
env["SHELL"] = self.callee.shell
env["LOCATION"] = "http://%s:%d/" % (
tornado.options.options.host, tornado.options.options.port)
env["PATH"] = '%s:%s' % (os.path.abspath(os.path.join(
os.path.dirname(__file__), '..', 'bin')), env.get("PATH"))
args = ['butterfly']
args = [shell]
if self.socket.local:
# All users are the same -> launch shell
if self.caller == self.callee and server == self.callee:
args.append('-i')
os.execvpe(
tornado.options.options.shell or self.callee.shell,
args, env)
os.execvpe(shell, args, env)
# This process has been replaced
return