diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/log.py | 3 | ||||
| -rw-r--r-- | python/plugin.py | 8 | ||||
| -rw-r--r-- | python/scriptingprovider.py | 7 |
3 files changed, 10 insertions, 8 deletions
diff --git a/python/log.py b/python/log.py index f7144183..b1fd7095 100644 --- a/python/log.py +++ b/python/log.py @@ -21,6 +21,7 @@ # Binary Ninja components import _binaryninjacore as core +from enums import LogLevel _output_to_log = False @@ -135,7 +136,7 @@ def log_alert(text): core.BNLogAlert("%s", str(text)) -def log_to_stdout(min_level): +def log_to_stdout(min_level=LogLevel.InfoLog): """ ``log_to_stdout`` redirects minimum log level to standard out. diff --git a/python/plugin.py b/python/plugin.py index c6cd9fc0..30a46412 100644 --- a/python/plugin.py +++ b/python/plugin.py @@ -560,8 +560,8 @@ class _BackgroundTaskMetaclass(type): tasks = core.BNGetRunningBackgroundTasks(count) result = [] for i in xrange(0, count.value): - result.append(BackgroundTask(core.BNNewBackgroundTaskReference(tasks[i]))) - core.BNFreeBackgroundTaskList(tasks) + result.append(BackgroundTask(handle=core.BNNewBackgroundTaskReference(tasks[i]))) + core.BNFreeBackgroundTaskList(tasks, count.value) return result def __iter__(self): @@ -570,9 +570,9 @@ class _BackgroundTaskMetaclass(type): tasks = core.BNGetRunningBackgroundTasks(count) try: for i in xrange(0, count.value): - yield BackgroundTask(core.BNNewBackgroundTaskReference(tasks[i])) + yield BackgroundTask(handle=core.BNNewBackgroundTaskReference(tasks[i])) finally: - core.BNFreeBackgroundTaskList(tasks) + core.BNFreeBackgroundTaskList(tasks, count.value) class BackgroundTask(object): diff --git a/python/scriptingprovider.py b/python/scriptingprovider.py index e7838748..988f856d 100644 --- a/python/scriptingprovider.py +++ b/python/scriptingprovider.py @@ -650,6 +650,7 @@ original_stdin = sys.stdin original_stdout = sys.stdout original_stderr = sys.stderr -sys.stdin = _PythonScriptingInstanceInput(sys.stdin) -sys.stdout = _PythonScriptingInstanceOutput(sys.stdout, False) -sys.stderr = _PythonScriptingInstanceOutput(sys.stderr, True) +def redirect_stdio(): + sys.stdin = _PythonScriptingInstanceInput(sys.stdin) + sys.stdout = _PythonScriptingInstanceOutput(sys.stdout, False) + sys.stderr = _PythonScriptingInstanceOutput(sys.stderr, True) |
