Reputation: 4122
I'm using CocoaDialog to present some feedback during execution of a download script. I wish to present an indeterminate progress bar whilst command operation us taking place. This is possible by piping text to CocoaDialog for the duration of the operation.
http://cocoadialog.sourceforge.net/documentation.html#progressbar_control
I thought I could do it using one command, as follows:
exec("curl -O $PATH_DOWNLOAD > $PATH_COCOADIALOG progressbar --indeterminate");
But this does not work.
Here's a more in-depth shell script that does it a different way:
http://cocoadialog.sourceforge.net/examples/progressbar.sh.txt
Any hints or tips appreciated.
Thanks,
matt
Upvotes: 0
Views: 1439
Reputation: 13028
You can do without named pipe. popen/pclose you mentioned allows you to communicate with the process through anonymous one. Named pipes really necessary only when dealing with non-related (parent/child) processes.
Like so:
$pipe = popen("| nameOfTheExecuable"); write($pipe, "Something"); .... pclose($pipe);
$pipe is the handle you can use to write to the standard input of your sub-process.
Upvotes: 0
Reputation: 4122
This works:
curl -O $PATH_DOWNLOAD 2>&1 | $PATH_COCOADIALOG progressbar --indeterminate
Upvotes: 1