mirror of
https://github.com/paradoxxxzero/butterfly.git
synced 2026-05-30 00:49:40 +00:00
Fix shell name in argv[0]
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user