[IPython-dev] magic for getting exit status

Ben Holroyd ben_holroyd_1 at hotmail.com
Mon Apr 27 07:58:36 EDT 2009


I'm posting this after being advised to get other peoples feedback on a bug report on launch pad.

https://bugs.launchpad.net/ipython/+bug/365553


      
    





      

        

      
        

        What I'm suggesting is basically something similar to $? in bash to get the
exit status, both for magic functions, and normal programs run through
the shell.

At the moment there isn't a way of checking if a
magic function successfully did what it was supposed to, and no way of
returning an exit status without it displaying on screen.

example: i wrote a magic to cd to a directory and ls its contents
(cdl), the obvious way would be to use the existing cd command, except
you can't test if its run successfully.

I know you can use the subprocess or commands module to get exit
codes but its not straight forward and has the disadvantage that you
can't check after the fact if a program exited successfully.






Any thoughts?





_________________________________________________________________
Share your photos with Windows Live Photos – Free.
http://clk.atdmt.com/UKM/go/134665338/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20090427/4d9b639d/attachment.html>


More information about the IPython-dev mailing list