(Change Version)

Final step: moved the error output switch to end of get_parameters. This lets you trigger 
the debugger -@ <debug number> flag without having to actually alter the code of inxi 
manually.

This might occasionally create undesired error output, but that's a good thing, since
that error output should be seen so we can know what the error is.
This commit is contained in:
inxi-svn 2008-11-11 19:34:25 +00:00
parent 5c754f182b
commit 241dc099b4

18
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.5.12 #### version: 0.5.13
#### Date: November 11 2008 #### Date: November 11 2008
######################################################################## ########################################################################
#### inxi is a fork of infobash, the original bash sys info script by locsmif #### inxi is a fork of infobash, the original bash sys info script by locsmif
@ -129,12 +129,8 @@ DCOPOBJ="default"
DEBUG=0 # Set debug levels from 1-10 DEBUG=0 # Set debug levels from 1-10
# Debug Buffer Index, index into a debug buffer storing debug messages until inxi is 'all up' # Debug Buffer Index, index into a debug buffer storing debug messages until inxi is 'all up'
DEBUG_BUFFER_INDEX=0 DEBUG_BUFFER_INDEX=0
### Reroute all error messages to the bitbucket (if not debugging) ## note: the debugger rerouting to /dev/null has been moved to the end of the get_parameters function
if [[ $DEBUG -eq 0 ]] ## so -@[number] debug levels can be set if there is a failure, otherwise you can't even see the errors
then
exec 2>/dev/null
fi
#((DEBUG)) && exec 2>&1 # This is for debugging konversation
# Defaults to 2, make this 1 for normal, 0 for no colorcodes at all. Set to any other valid scheme you like. # Defaults to 2, make this 1 for normal, 0 for no colorcodes at all. Set to any other valid scheme you like.
# Same as runtime parameter. # Same as runtime parameter.
@ -481,7 +477,7 @@ get_cmdline()
while read -d $'\0' L && [ "$i" -lt 32 ] while read -d $'\0' L && [ "$i" -lt 32 ]
do do
A_CMDL[i++]="$L" ## note: make sure this is valid - What does L mean? ## A_CMDL[i++]="$L" ## note: make sure this is valid - What does L mean? ##
done </proc/$ppid/cmdline done < /proc/$ppid/cmdline
##print_screen_output "\$i='$i'" ##print_screen_output "\$i='$i'"
if [[ $i -eq 0 ]];then if [[ $i -eq 0 ]];then
A_CMDL[0]=$(< /proc/$ppid/cmdline) A_CMDL[0]=$(< /proc/$ppid/cmdline)
@ -597,6 +593,12 @@ get_parameters()
;; ;;
esac esac
done done
## this must occur here so you can use the debugging flag to show errors
## Reroute all error messages to the bitbucket (if not debugging)
if [[ $DEBUG -eq 0 ]];then
exec 2>/dev/null
fi
#((DEBUG)) && exec 2>&1 # This is for debugging konversation
} }
## print out help menu, not including Testing or Debugger stuff because it's not needed ## print out help menu, not including Testing or Debugger stuff because it's not needed