fixed output logs
This commit is contained in:
@@ -31,32 +31,47 @@ sed \
|
||||
"$TCL_SCRIPT" > "$TMP_TCL"
|
||||
|
||||
echo "→ Running FlatCAM headless..."
|
||||
echo " Gerber : $GERBER_ABS"
|
||||
echo " Output : $OUTPUT_ABS"
|
||||
echo " Gerber : $GERBER"
|
||||
echo " Output : $OUTPUT"
|
||||
echo ""
|
||||
|
||||
source "$FLATCAM_ENV/bin/activate"
|
||||
|
||||
# Run FlatCAM, watch for the WriteGCode confirmation line, then kill it
|
||||
# FlatCAM hangs on quit due to Qt GUI cleanup — we kill it cleanly once done
|
||||
# Run FlatCAM, watch for the Quit confirmation line, then kill it
|
||||
# FlatCAM hangs on quit due to Qt GUI cleanup — we kill it cleanly once done.
|
||||
# Disable pipefail here: we intentionally kill the process, so its nonzero
|
||||
# exit status should not abort the rest of this script.
|
||||
set +e
|
||||
set +o pipefail
|
||||
python "$FLATCAM_PY" --shellfile="$TMP_TCL" --headless=1 2>&1 | \
|
||||
while IFS= read -r line; do
|
||||
echo "$line"
|
||||
# Show WARNING, ERROR, and script puts output; suppress DEBUG and INFO noise
|
||||
if [[ "$line" == *"[WARNING]"* || "$line" == *"[ERROR]"* || "$line" != *"["* ]]; then
|
||||
[[ "$line" == *"RUNNING HEADLESS"* ]] && continue
|
||||
[[ "$line" == *"QWidget::setMaximumSize"* ]] && continue
|
||||
[[ "$line" == *"Image Import plugin"* ]] && continue
|
||||
[[ "$line" == *"Joining"*"polygons"* ]] && continue
|
||||
[[ "$line" == *"Union(buffer)"* ]] && continue
|
||||
[[ "$line" == *"Total number of polygons"* ]] && continue
|
||||
[[ "$line" == *"Number of paths for which"* ]] && continue
|
||||
echo "$line"
|
||||
fi
|
||||
if [[ "$line" == *"TclCommandQuit"* ]]; then
|
||||
# Give it a moment to finish flushing the file
|
||||
sleep 3
|
||||
# Kill the FlatCAM process
|
||||
pkill -f "flatcam.py.*headless" 2>/dev/null || true
|
||||
pkill -f "flatcam.py.*headless" 2>/dev/null &
|
||||
disown
|
||||
fi
|
||||
done
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
rm -f "$TMP_TCL"
|
||||
|
||||
# Verify output was created
|
||||
if [ -f "$OUTPUT_ABS" ]; then
|
||||
SIZE=$(wc -l < "$OUTPUT_ABS")
|
||||
SIZE=$(wc -l < "$OUTPUT")
|
||||
echo ""
|
||||
echo "✓ Done: $OUTPUT_ABS ($SIZE lines)"
|
||||
echo "✓ Done: $OUTPUT ($SIZE lines)"
|
||||
else
|
||||
echo ""
|
||||
echo "✗ ERROR: output file not created — check log above"
|
||||
|
||||
Reference in New Issue
Block a user