Skip to content
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

More configurable (choose what sys.__std*__/sys.std* to patch on connect time) #11

Open
ionelmc opened this issue Aug 31, 2014 · 11 comments

Comments

@ionelmc
Copy link
Owner

ionelmc commented Aug 31, 2014

No description provided.

@nirs
Copy link
Collaborator

nirs commented Sep 1, 2014

This is not something that should be configurable. We can avoid patching stdin, by taking input directly from the socket - but you cannot avoid patching stdout and stderr - otherwise you loose some output.

If you look into twisted.manhole.telnet.py, you can see that they patch only stdout and stderr. I think this is good enough, as daemons that may use the manhole never take input from stdin.

@ionelmc ionelmc changed the title More configurable (chose what sys.__std*__/sys.std* to patch on connect time) More configurable (cheose what sys.__std*__/sys.std* to patch on connect time) Sep 1, 2014
@ionelmc ionelmc changed the title More configurable (cheose what sys.__std*__/sys.std* to patch on connect time) More configurable (choose what sys.__std*__/sys.std* to patch on connect time) Sep 1, 2014
@ionelmc
Copy link
Owner Author

ionelmc commented Sep 1, 2014

I'm thinking what happens if you do import pdb; pdb.set_trace() in the session. It won't work if stdin is not redirected ...

@nirs
Copy link
Collaborator

nirs commented Sep 2, 2014

I never tried it. I think that the safest way would be to use all sys.stdxxx files as you do now.

I would close this issue for now.

@ionelmc
Copy link
Owner Author

ionelmc commented Sep 2, 2014

I still wanna make it configurable one day, don't close it 😬

@ionelmc
Copy link
Owner Author

ionelmc commented Sep 3, 2014

Another trick we could do it do a thread-local proxy for inputs/outputs (like here https://github.com/py-eww/eww/blob/master/eww/ioproxy.py). Worth noting eww is very similar to manhole.

@nirs
Copy link
Collaborator

nirs commented Sep 3, 2014

I think it is incorrect - you want output from all threads to go to your console.

For example, you may call a function that start a thread and run a subprocess, reading from the process stdout and printing. If we use thread local, I will not see the output from the new thread in my console.

@ionelmc
Copy link
Owner Author

ionelmc commented Sep 3, 2014

I was pointing out the technique - as it would allow multiple client
connections (#7). There are tradeoffs ofcourse - so it could be something
configurable.

Eg, have an option multiple_clients=False; if it's True then the
threadlocal redirection is used.

Thanks,
-- Ionel M.

On Wed, Sep 3, 2014 at 4:57 PM, Nir Soffer [email protected] wrote:

I think it is incorrect - you want output from all threads to go to your
console.

For example, you may call a function that start a thread and run a
subprocess, reading from the process stdout and printing. If we use thread
local, I will not see the output from the new thread in my console.


Reply to this email directly or view it on GitHub
#11 (comment)
.

@nirs
Copy link
Collaborator

nirs commented Sep 5, 2014

It will not work for multiple connections. It will allow each connection to run code like:
print "foo"
But again if you start another thread, no connection will get the other thread output.

Do you see a use case where 2 people connect in the same time to the same process?

If there is a reall need for this, I think the solution is that stdin will use the connection socket, and stdout/err will send output to all connected clients.

@ionelmc
Copy link
Owner Author

ionelmc commented Sep 6, 2014

I don't have an usecase right now, I'm just writing down ideas.

In the future we could build some specialized client (to get interesting info from the process). You'd still want to be able to run that tool while you have an open session.

@ionelmc
Copy link
Owner Author

ionelmc commented Sep 27, 2014

Ref #23

@nirs
Copy link
Collaborator

nirs commented Dec 23, 2017

I still think closing this issue is the best way. 3 years passed and nobody asked for this feature :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants