Riad KACED wrote, on 05/08/08 00:31:
> Hi There !
>
> If I well understood your description, you don't seem to be interested
> in communicating with your child process (calibre). i,e, you're
> running Calibre in the background and let your skill running
> regardless whether calibre succeeded to run or not. So if you don't
> bother about communicating with your child process, why do you want to
> use the ipc functions ? I'm pretty much sure I'm missing something :-(
>
> I would advice the following in your case (This is an example):
> ; Print your calibre command into a string : calibreCommand
> sprintf(calibreCommand "/yourMgcInstallDir/bin/calibre -drc -hier -
> whateverOptionOrCtrlFile %s/%s.gds &" dirName cellName)
> system(calibreCommand)
>
> Anyway, This a little example about using IPCs
>
> ;-----------------------------------------------------------------
> ; Get The user name from unix
> cidUser = ipcBeginProcess("whoami")
> ipcWait(cidUser)
> ridUser=car(parseString(ipcReadProcess(cidUser) "\n"))
>
> ; Get The hostname from unix
> cidHost = ipcBeginProcess("uname -n")
> ipcWait(cidHost)
> ridHost=car(parseString(ipcReadProcess(cidHost) "\n"))
> ;-----------------------------------------------------------------
>
> I saw you are using csh() to run your Calibre and I guess it is for a
> purpose. In the case you move to ipc, you have to know that 'ipc' is
> not running commands under your default login shell even if the
> commands are passed through it, ipcBeginProcess executes commands
> using Bourne Shell (sh).
>
> BTW : What does it mean "... but behavior of my skill program is not
> as expected ! "
>
> Hope this help you !
>
> Interesting and Could be useful :
> Interprocess Communication SKILL Functions Reference -->
> $CDSHOME/doc/skipcref.pdf
>
> Riad.
My guess is that he needs to know when it's finished - to do some further
processing - but doesn't want the session to block.
So something like:
procedure(MYexitHandler(cid status)
... do the things you want to do when Calibre has finished ...
)
; just to print any output from the command to the CIW
procedure(MYdataHandler(cid data)
printf("%s" data)
)
ipcBeginProcess("calibre ..." "" 'MYdataHandler 'MYdataHandler
'MYexitHandler)
For every bit of output that the calibre command produces, it will call
the data
handler and print it. This happens asynchronously, so it doesn't block
DFII.
When the child process exits, the MYexitHandler function will get called,
and
then you can execute any further SKILL code you need - safe in the
knowledge
that the calibre job exited.
Regards,
Andrew.


|