-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to access console output from Far Plugin? #2387
Comments
Far2 API documentation (from classic windows version) you can see in https://api.farmanager.com/ru/index.html (in Russian). May be |
Far2 Encyclopedia CHM can be downloading within far2.x86.msi/far2.x64.msi from https://farmanager.com/history.php (two last links) |
Sorry, probably I was not clear enough. I am not talking about current screen of Far, I am talking about terminal output of the last command. The one that is covered by panels, SaveScreen will not help me here. Didn't find anything in the encyclopedia. |
Its not exposed to API anyhow for now, but can consider it. So please tell what you want to achieve to understand how its better to implement |
And may be it can be useful for you - its how console history is accessible inside far2l itself: https://github.com/elfmz/far2l/blob/master/far2l/src/vt/vtlog.h |
I would like to make a plugin which will scan the traceback from the console and will automatically open editor on the appropriate file, line, and column. That would be very helpful because this happens all the time when I run some script, something crashes, I scan the file name, go to the file, open it, Alt+F8, input line, etc. |
I assume std::string GetAsFile(HANDLE con_hnd, bool colored, bool append_screen_lines = true); Is what would be helpful if exposed to plugin. |
A much better solution is to make WinPort.h functions available to Python, just like C/C++ plugins have. switch to user screen: hr = winport.GetConsoleScreenBufferInfo(...) switch back: |
Will it allow to get full output - even parts that are not currently visible? |
unfortunately not :(, the rest is hidden in the _memories buffer |
Wouldn't it be easier to use a decorator to catch errors?
|
then exposing GetAsFile is better |
Not sure I understood you. Are you questioning the need/usefulness of the plugin which will scan traceback from console? |
GetAsFile is more complete and explicit, as I find getting the traceback from a variable rather than licking it from the screen |
Getting traceback in code as you develop and scanning the crash that already happened and dumped in output are two completely different cases. Scanning traceback from output and opening in Far editor is a universal solution which works not only for your code, but for crashes in other people's code. Also it can work not just for python, but for any language that prints parse-able traceback, Node.js, etc. The parser would work not only just from output, it would also work from far viewer so you can conveniently jump from tracebacks in logs too, but scanning output stream is essential for such plugin to be useful for me. |
please see #2454 - if its ok, or may be ned to add something? |
Is it possible? How?
The text was updated successfully, but these errors were encountered: