On 06.08.19 13:29, Ido Rosenzwig wrote:
I have a project, a cockpit plugin - cockpit-ovirt written in ReactJS.
In the project, I need to run a script that will run for a long time
(~20-30 minutes) that will be executed after an event has occurred
(let's say a button click).
This script outputs a stream of data and I would like to get the data in
cockpit and print it to the screen during the time the script is executed.
What is the recommended way to do it using cockpit API ?
While you could use channels directly, the cockpit.spawn() API works
well for this:
Something like this:
process = cockpit.spawn(["/path/to/script"], err: "message");
/* invoked if script fails */
/* invoked for every block of data script write to stdout */
Use this option to include stderr output in the streamed output:
If the script expects input or EOF on stdin, you can send it using:
... respectively. Hope this helps,
I saw the raw channel documentation, but found no examples / usage that
I can use.
cockpit-devel mailing list -- cockpit-devel(a)lists.fedorahosted.org
To unsubscribe send an email to cockpit-devel-leave(a)lists.fedorahosted.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines