What can use in place of NSTask : waitUntilExit?

Discussion in 'Mac Programming' started by newformac, Aug 9, 2011.

  1. newformac macrumors regular

    Joined:
    May 24, 2011
    #1
    hi all,

    i am using NSTask and some times waitUntilExit not return and application become unresponsive so please tell me is there any other function that can i use in place of waitUntilExit

    or

    any other method to prevent my application unresponsive and check if there is something wrong return with some error value or else.

    please give suggestions for this.

    thanks.
     
  2. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    Location:
    Sailing beyond the sunset
    #2
    What programs are you running with NSTask? Be specific.

    Are any of them producing standard output streams? Are any of them reading their standard input streams? If they are, and you don't read the output or give them the input, then the program may wait forever, which would cause the exact symptom you see.


    There are C functions that do things similar to NSTask, but you still have to know how the sub-programs you run work. That is, you can get wait-forever from the C functions, too, if you don't know what you're doing.

    The C function system() is one such function. The popen() function is another. Read their man pages to see how they work.
     
  3. newformac thread starter macrumors regular

    Joined:
    May 24, 2011
    #3
  4. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    Location:
    Sailing beyond the sunset
    #4
  5. newformac thread starter macrumors regular

    Joined:
    May 24, 2011
    #5
    how to improve the error handling in the python code for timeout error, or how to change the Objective-C code handle python hang on problem.
     
  6. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    Location:
    Sailing beyond the sunset
    #6
    What have you tried?

    You haven't explained exactly what causes the problem. Which port? Which other parameters?

    You haven't explained what level of programming skill you have, or what you're learning from.

    If you don't know how to program well enough to even try solving this problem, then you need to go back to learn the fundamentals. You can't program effectively just by copying and pasting code you find on the internet.
     
  7. newformac thread starter macrumors regular

    Joined:
    May 24, 2011
    #7
    thanks its done now. i am using time-out in python script.
     

Share This Page