NSTask and readInBackgroundAndNotify
NSTask and readInBackgroundAndNotify
- Subject: NSTask and readInBackgroundAndNotify
- From: Thomas Lachand-Robert <email@hidden>
- Date: Sun, 30 Dec 2001 00:51:40 +0100
Hi all,
I'm having problems with NSTask and readInBackgroundAndNotify. In my app,
I would like to execute a shell script which has been typed in a text view.
I use an NSTask calling /bin/sh, use parameter -s, passes the script as a
input and read the output with readInBackgroundAndNotify. This works.
However /bin/sh doesn't read all the environment variables, so I would
like to use /bin/csh or /bin/tsch instead. And here problems occurs. Most
of the time I get only some part of the output, for instance for the
script:
pwd ; echo "hello" ; ls
I get the pwd and echo, not the ls. (I reiterate that it works with
/bin/sh; it tooks me a long time to check that all the output has to be
flushed some way before termination).
Even worse: I sometimes get the output in reverse order! (in my example,
the echo and THEN the pwd).
I don't understand this different behavior of csh to sh. Any clue would be
gretly appreciated.
Thomas Lachand-Robert
********************** email@hidden
<< Et le chemin est long du projet ` la chose. >> Molihre, Tartuffe.