ADT
        ast-experimental
      
      
        
          | 
            Last change
 on this file since e2887a9 was             b813f53, checked in by Thierry Delisle <tdelisle@…>, 5 years ago           | 
        
        
          | 
             
Improvement of handling of \r processing halts 
 
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100755
               
             
           | 
        
        
          | 
            File size:
            719 bytes
           | 
        
      
      
| Line |   | 
|---|
| 1 | #!/bin/bash -e
 | 
|---|
| 2 | 
 | 
|---|
| 3 | SAVE_TEMPS=false
 | 
|---|
| 4 | while (( "$#" )); do
 | 
|---|
| 5 |         case "$1" in
 | 
|---|
| 6 |         -s|--save-temps)
 | 
|---|
| 7 |                 SAVE_TEMPS=true
 | 
|---|
| 8 |                 shift
 | 
|---|
| 9 |                 ;;
 | 
|---|
| 10 |         *) # preserve positional arguments
 | 
|---|
| 11 |                 PARAMS="$PARAMS $1"
 | 
|---|
| 12 |                 shift
 | 
|---|
| 13 |                 ;;
 | 
|---|
| 14 |         esac
 | 
|---|
| 15 | done
 | 
|---|
| 16 | # set positional arguments in their proper place
 | 
|---|
| 17 | eval set -- "$PARAMS"
 | 
|---|
| 18 | 
 | 
|---|
| 19 | if $SAVE_TEMPS; then
 | 
|---|
| 20 |         tmpfile=$(mktemp --tmpdir=$(pwd))
 | 
|---|
| 21 |         echo "Saving to $tmpfile"
 | 
|---|
| 22 | else
 | 
|---|
| 23 |         tmpfile=$(mktemp)
 | 
|---|
| 24 |         function finish {
 | 
|---|
| 25 |                 rm -rf "$tmpfile"
 | 
|---|
| 26 |         }
 | 
|---|
| 27 |         trap finish EXIT
 | 
|---|
| 28 | fi
 | 
|---|
| 29 | # split the wanted and unwanted output
 | 
|---|
| 30 | awk "BEGIN{RS = \"[\n\r]\"}/^Processor|^PH:[0-9]+ - [0-9]+ [0-9]+/ {print \$0 > \"$tmpfile\"; next}{print \$0; fflush()}"
 | 
|---|
| 31 | 
 | 
|---|
| 32 | # pass the data to the python scirpt
 | 
|---|
| 33 | DIR=$( dirname "${BASH_SOURCE[0]}")
 | 
|---|
| 34 | cat $tmpfile | $DIR/view_halts.py ${PARAMS}
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.