Best Way To Bound Function Execution Time

Discussion in 'Python' started by Tim Daneliuk, Dec 31, 2011.

  1. Tim Daneliuk

    Tim Daneliuk Guest

    I am writing some paramiko-based ssh routines. One of them logs into
    a remote server and then does a sudo command. The problem is that if
    the user provides the incorrect sudo password, the call hangs the other
    end is waiting for the correct password to be entered.

    Is there some standard Pythonic way to bound how long a function
    call can run, after which time it is forcefully terminated?

    TIA,
    --
    ----------------------------------------------------------------------------
    Tim Daneliuk
    PGP Key: http://www.tundraware.com/PGP/
     
    Tim Daneliuk, Dec 31, 2011
    #1
    1. Advertising

  2. Tim Daneliuk

    Paul Rubin Guest

    Tim Daneliuk <> writes:
    > Is there some standard Pythonic way to bound how long a function
    > call can run, after which time it is forcefully terminated?


    Basically, run it in a separate process and use os.kill to kill it.
     
    Paul Rubin, Dec 31, 2011
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sunil panda

    Lower bound & Upper bound

    sunil panda, Dec 25, 2003, in forum: Java
    Replies:
    9
    Views:
    7,355
    thushara wijeratna
    Oct 7, 2008
  2. Replies:
    8
    Views:
    484
    Oliver Wong
    Mar 29, 2006
  3. Rhiner Dan
    Replies:
    1
    Views:
    773
    Mike Wahler
    Mar 27, 2005
  4. Mario Krsnic
    Replies:
    0
    Views:
    398
    Mario Krsnic
    Jun 23, 2006
  5. Phillip Vong
    Replies:
    0
    Views:
    433
    Phillip Vong
    Jul 27, 2006
Loading...

Share This Page