images/genicons.sh
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Thu, 28 Apr 2016 13:05:57 +0300
changeset 1507 d7f474d10210
parent 533 25437efb7ae4
child 2238 a01a3ed1af2c
permissions -rwxr-xr-x
fix issue with sometimes wrong return code of ProcessLogger


As a result of wrong return code Beremiz gives folowing traceback:
Traceback (most recent call last):
File "./Beremiz.py", line 850, in OnMenu
getattr(self.CTR, method)()
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 925, in _Build
IECGenRes = self._Generate_SoftPLC()
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 568, in _Generate_SoftPLC
return self._Compile_ST_to_SoftPLC()
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 661, in _Compile_ST_to_SoftPLC
C_files.remove("POUS.c")
ValueError: list.remove(x): x not in list

The problem is that both threads (for reading stdout and stderr) call self.Proc.poll(),
that updates internal returncode field. This call is done without any locking and the first thread gets correct result,
but other gets 0 as retval. If 0 gets thread, that afterwards calls callback finish, then wrong return code is returned
to the parent. Now only the thread with a callback polls for the return code, other thread just checked local value.

Additionally function spin() waits now until all threads finish reading their pipes, so the results are always correct.
197
a50b5fa04c57 SVG/Inkscape based icon generation script + SVG drawing.
etisserant
parents:
diff changeset
     1
#!/bin/bash
a50b5fa04c57 SVG/Inkscape based icon generation script + SVG drawing.
etisserant
parents:
diff changeset
     2
a50b5fa04c57 SVG/Inkscape based icon generation script + SVG drawing.
etisserant
parents:
diff changeset
     3
INKSCAPE=inkscape
a50b5fa04c57 SVG/Inkscape based icon generation script + SVG drawing.
etisserant
parents:
diff changeset
     4
a50b5fa04c57 SVG/Inkscape based icon generation script + SVG drawing.
etisserant
parents:
diff changeset
     5
for i in `cat icons.svg |grep -o -e '%%[^%]*%%'|sed 's/%//g'` 
a50b5fa04c57 SVG/Inkscape based icon generation script + SVG drawing.
etisserant
parents:
diff changeset
     6
do
199
aa5f43bafad4 minor gui improvements :
etisserant
parents: 197
diff changeset
     7
 if [ $i.png -nt icons.svg ]; then
aa5f43bafad4 minor gui improvements :
etisserant
parents: 197
diff changeset
     8
 	echo "Skip $i"
aa5f43bafad4 minor gui improvements :
etisserant
parents: 197
diff changeset
     9
 else
aa5f43bafad4 minor gui improvements :
etisserant
parents: 197
diff changeset
    10
	rm  -f $i.png
aa5f43bafad4 minor gui improvements :
etisserant
parents: 197
diff changeset
    11
	echo "$INKSCAPE" icons.svg -z -e $i.png -i $i
aa5f43bafad4 minor gui improvements :
etisserant
parents: 197
diff changeset
    12
	"$INKSCAPE" icons.svg -z -e $i.png -i $i
aa5f43bafad4 minor gui improvements :
etisserant
parents: 197
diff changeset
    13
 fi
197
a50b5fa04c57 SVG/Inkscape based icon generation script + SVG drawing.
etisserant
parents:
diff changeset
    14
done
a50b5fa04c57 SVG/Inkscape based icon generation script + SVG drawing.
etisserant
parents:
diff changeset
    15
a50b5fa04c57 SVG/Inkscape based icon generation script + SVG drawing.
etisserant
parents:
diff changeset
    16
cp ico24.png brz.png
533
25437efb7ae4 Christmas 2009 release
Edouard TISSERANT <edouard.tisserant@gmail.com>
parents: 199
diff changeset
    17
convert ico*.png brz.ico
25437efb7ae4 Christmas 2009 release
Edouard TISSERANT <edouard.tisserant@gmail.com>
parents: 199
diff changeset
    18
rm -f ico*.png