• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: debug a forked PTY process
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: debug a forked PTY process


  • Subject: Re: debug a forked PTY process
  • From: F van der Meeren <email@hidden>
  • Date: Mon, 8 Mar 2010 17:27:23 +0100

Could you give a code sample?

At first glance it may be possible that the PTYTask failed on the execve. Since the code doesn't do any error-checking.
If the execve fails to invoke the other executable, then it proceeds with the current execution-stack, and then it is doomed to crash and burn.
A fix could be putting "_exit(EXIT_FAILURE);" behind the code. But my advice is rewriting that PTYTask interface. Or at least inserting statements like the following "if(posixMethod() == -1) { NSLog("Something" }" everywhere you find a posix method (the resulting values are different for each method).

Filip


On 08 Mar 2010, at 16:23, Nadav Tenenbaum wrote:

during developing a dashboard widget that requires an interactive use with OS X shell, I have found out that simply using NSTask doesn't work for certin uses I need.
so, in search for a solution, I have found a class which does exactly what I need: PTYTask

what this class does is to fork a PTY process and then provide an interface to it, kind of like NSTask

the problem is that when debugging using gdb, the following error appears a lot of times:
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_
YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.

what does this mean and what can I do with that?
  
Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >debug a forked PTY process (From: Nadav Tenenbaum <email@hidden>)

  • Prev by Date: Re: debug a forked PTY process
  • Next by Date: Re: debug a forked PTY process
  • Previous by thread: Re: debug a forked PTY process
  • Next by thread: Instruments, Leaks, and task_for_pid privileges
  • Index(es):
    • Date
    • Thread