NSTask and osascript

I’m trying to write a foundation tool that uses NSTask to launch an osascript, but the tool seems to collect pipes. Here’s the output from lsof:

myd 9844 root 3 PIPE 0x3a6a488 16384
myd 9844 root 4 PIPE 0x3a6a518 16384
myd 9844 root 5 PIPE 0x3a6ab00 16384
myd 9844 root 6 PIPE 0x3a69fc0 16384
myd 9844 root 7 PIPE 0x3a69e58 16384
myd 9844 root 8 PIPE 0x3a6a170 16384
myd 9844 root 9 PIPE 0x3a69ca8 16384
myd 9844 root 10 PIPE 0x3a69ea0 16384
myd 9844 root 11 PIPE 0x3a6a050 16384
myd 9844 root 12 PIPE 0x3a6a320 16384
myd 9844 root 13 PIPE 0x3a69e10 16384
myd 9844 root 14 PIPE 0x3a6a3b0 16384
myd 9844 root 15 PIPE 0x3a6a8c0 16384
myd 9844 root 16 PIPE 0x3a6a2d8 16384
myd 9844 root 17 PIPE 0x3a6a008 16384
myd 9844 root 18 PIPE 0x3a69870 16384
myd 9844 root 19 PIPE 0x3a691b0 16384
myd 9844 root 20 PIPE 0x3a695a0 16384
myd 9844 root 21 PIPE 0x3a69948 16384

This continues until there’s too man open pipes, then of course it stalls with an error.

Even though I’m using [task terminate];
[pool release];

in my method (which fired by NSTimer and held in an NSRunLoop)

the pipes will not die.

How can I make them die?

hi deanshavit,

try adding [task waitUntilExit] before terminating it …

hope it helps :slight_smile:

D.