Executing interactive subprocesses as "actions"

Asked by Alexey Zakhlestin

Is there some official way to run interactive subprocess as action?

For example, I'd like to run "ipython" as one of the actions after setting up proper debugging environment.

Question information

Language:
English Edit question
Status:
Answered
For:
doit Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
schettino72 (schettino72) said :
#1

Hi Alexey,

Currently there is no "official way" of doing this, but it should have one. So I created a bug to track this.

I dont know of any implementation of this. It should be easy to do... If you want to give it a try please assign the bug to yourself so we can add this to doit :)

cheers

Revision history for this message
Alexey Zakhlestin (indeyets) said :
#2

in my script, I just used something like this, for now:

        import subprocess
        subprocess.call([PATH_TO_IPYTHON], stdout=None, stderr=None, env=method_which_returns_custom_env())

I am not ready to dive into doit's internals right now. I'll get to it later, if noone else gets there first :)

Revision history for this message
schettino72 (schettino72) said :
#3

ok. JFYI you actually don't need to dive into doit's internals to implement this.

I guess you can implement it with 10 lines of code if you subclass doit/actions.py:CmdAction. My implementation based on PythonAction was 4 lines of code :) (http://pastebin.com/zFMmmECA)

Revision history for this message
schettino72 (schettino72) said :
#4

Can you help with this problem?

Provide an answer of your own, or ask Alexey Zakhlestin for more information if necessary.

To post a message you must log in.