[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] /* XXX - possibly run Coproc->name through word expansion? */

From: Piotr Grzybowski
Subject: [patch] /* XXX - possibly run Coproc->name through word expansion? */
Date: Sat, 16 Apr 2016 17:13:57 +0200


 for some time I wanted to do:

for((i=0;i<${WORKERS_COUNT};i++)); do
 coproc worker$i { worker_code; };

 and since lately I got an actual real, production, case where I had to run given number of workers and issue jobs for them (exactly: run N encoders in M co-processes and pass the list of files to encode for each worker on its stdin), I got the attached patch. It does the following:

- expand the name given to coproc
- if it expands to a legal identifier create the coproc

 As I have found just now, it addresses the comment:

/* XXX - possibly run Coproc->name through word expansion? */

 and also fixes the apparent problem with the creation of co-processes with wicked names, which is currently possible, e.g.:

coproc `well this is strange name` { sleep 64; }
set | grep "this is"

 I would also love to see the coproc built-in to support the listing of co-processes by name, with:

coproc -list

which needs a bit of cleaning in the co-process model.
 What do you think?


 the names of the list and the word: l and w, respectively, are not in the lines of very good practices, probably I should have chosen something better.

Attachment: 0001-coproc-name-word-expansion.patch
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]