-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
run (shell specific?): allow for background mode? #30
Comments
Yes but how would you implement that? |
;-) good question... quick and ugly could be as $> python -c 'import os; os.system( "bash -c \"{ sleep 4; echo done; } & disown\" " )'; echo exited; sleep 2; echo slept
exited
slept
$> done ie qwe could just start a new one of itself (but in foreground) and detach. But I think there is a more "natural" way... we did something like that in fail2ban but I had not touched that project for so long and it changed so much that I can't quickly find... theoretically IIRC it is -- "fork into a new child subprocess; child continues; parent quits"... ha -- I said "fork" and that lead me to a new search within fail2ban to immediately find it: |
How would we capture the result and return code then? This could be appropriate for an executor that doesn't need those variables (and I don't think I'd use os.system, I've read somewhere that's not great practice) but not for a basic shell executor that requires them. |
I think I'm leaning on the side of being conservative with respect to using os.fork, os.system, or subprocess with shell=True, but I do think there are libraries we can try get at async, or just test using a & as a user normally would. See https://stackoverflow.com/questions/30157895/does-python-os-fork-uses-the-same-python-interpreter for some of my concerns, and let's pick up discussion around this in #2, which I've been thinking about since I started the library! Closing this issue, let's pick up in #2. |
ATM
qme run
execution awaits for completion of the task. Being able to just submit for running the task in the background would be super useful.The text was updated successfully, but these errors were encountered: