Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: check if coproc has output



I did again the search in the manual and now I found it, maybe I mistyped the first time
where do you suggest I try to print this array?

Pier Paolo Grassi


Il giorno gio 19 gen 2023 alle ore 17:10 Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> ha scritto:
Are you running zsh 3.0? That would only explain lack of following in zshall:

       jobtexts
              This associative array maps job numbers to the texts of the command
              lines that were used to start the jobs.

              Handling  of  the keys of the associative array is as described for
              jobdirs above.


On Thu, 19 Jan 2023 at 16:08, Pier Paolo Grassi <pierpaolog@xxxxxxxxx> wrote:
I'm sorry, what is $jobtexts? it seems an empty variable to me and doesn't appear in zshall manual

Pier Paolo Grassi


Il giorno gio 19 gen 2023 alle ore 17:02 Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> ha scritto:
You could get pid from $jobtexts?

On Thu, 19 Jan 2023 at 15:43, Pier Paolo Grassi <pierpaolog@xxxxxxxxx> wrote:
I realize now the subject doesn't reflect the final version of the mail, sorry for that

Pier Paolo Grassi


Il giorno gio 19 gen 2023 alle ore 16:32 Pier Paolo Grassi <pierpaolog@xxxxxxxxx> ha scritto:
Hello, I want to populate an array from a long running process, something like:

long_running_process | while read line
do
  array+=$line
done

problem is, since long_running_process does not continually produce output but only some times, when i try to interrupt this pipeline with ctrl-c I have to wait until it produces some output for the process to terminate (because, as I understand it, when it tries to write to the pipe it receives a sigpipe due to it being already closed)

I have tried various constructs with trap and even coproc to be able to intercept the ctrl-c and send a sigpipe to the long running process, but to no result.

I wonder if someone has some solution to share for this problem, thanks

Pier Paolo Grassi


--
Best regards,
Sebastian Gniazdowski



--
Best regards,
Sebastian Gniazdowski



Messages sorted by: Reverse Date, Date, Thread, Author