mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 04:32:36 +01:00
Added progstats and environ commands.
This commit is contained in:
parent
e8c6e6f978
commit
dd1c287655
@ -37,6 +37,8 @@ committed, remove it immediately. It must not be released with Supybot.
|
|||||||
import supybot.plugins as plugins
|
import supybot.plugins as plugins
|
||||||
|
|
||||||
import gc
|
import gc
|
||||||
|
import os
|
||||||
|
import pwd
|
||||||
import sys
|
import sys
|
||||||
import exceptions
|
import exceptions
|
||||||
|
|
||||||
@ -53,6 +55,16 @@ def getTracer(fd):
|
|||||||
print >>fd, '%s: %s' % (code.co_filename, code.co_name)
|
print >>fd, '%s: %s' % (code.co_filename, code.co_name)
|
||||||
return tracer
|
return tracer
|
||||||
|
|
||||||
|
def progstats():
|
||||||
|
pw = pwd.getpwuid(os.getuid())
|
||||||
|
response = 'Process ID %s running as user "%s" and as group "%s" ' \
|
||||||
|
'from directory "%s" with the command line "%s". ' \
|
||||||
|
'Running on Python %s.' % \
|
||||||
|
(os.getpid(), pw[0], pw[3],
|
||||||
|
os.getcwd(), ' '.join(sys.argv),
|
||||||
|
sys.version.translate(string.ascii, '\r\n'))
|
||||||
|
return response
|
||||||
|
|
||||||
class Debug(callbacks.Privmsg):
|
class Debug(callbacks.Privmsg):
|
||||||
capability = 'owner'
|
capability = 'owner'
|
||||||
def __init__(self, irc):
|
def __init__(self, irc):
|
||||||
@ -172,6 +184,22 @@ class Debug(callbacks.Privmsg):
|
|||||||
irc.reply(format('%L', map(str, L)))
|
irc.reply(format('%L', map(str, L)))
|
||||||
collect = wrap(collect, [additional('positiveInt', 1)])
|
collect = wrap(collect, [additional('positiveInt', 1)])
|
||||||
|
|
||||||
|
def progstats(self, irc, msg, args):
|
||||||
|
"""takes no arguments
|
||||||
|
|
||||||
|
Returns various unix-y information on the running supybot process.
|
||||||
|
"""
|
||||||
|
irc.reply(progstats())
|
||||||
|
progstats = wrap(progstats)
|
||||||
|
|
||||||
|
def environ(self, irc, msg, args):
|
||||||
|
"""takes no arguments
|
||||||
|
|
||||||
|
Returns the environment of the supybot process.
|
||||||
|
"""
|
||||||
|
irc.reply(repr(os.environ))
|
||||||
|
environ = wrap(environ)
|
||||||
|
|
||||||
|
|
||||||
Class = Debug
|
Class = Debug
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user