Ok, Let me understand it. So the keyboard interrupted exception is coming from prompt.py, not from grass.py. If I replace prompt.py with prompt.sh, I'm out of python completely and not facing performance hit either?
I thought as long as grass.py launches bash with whatever PROMPT_COMMAND either being prompt.py or prompt.sh, I'm inside a python process and cannot avoid keyboard interuption exceptions and slow performance. Huidae On May 12, 2014 6:37 PM, "Glynn Clements" <[email protected]> wrote: > > Huidae Cho wrote: > > > Would I miss any functionalities by using prompt.sh? > > No. > > > I mean other than portability between OSs, > > prompt.py doesn't provide that. The only way in which the script is > executed is by setting the bash variable PROMPT_COMMAND. If set, bash > treats its value as a command to execute prior to displaying the > primary prompt ($PS1). > > If you're using bash, you can use either prompt.sh or prompt.py (or > something of your own devising, or nothing). If you aren't using bash, > neither of those scripts are of any use to you. > > > does prompt.py provide other benefits? If there's > > nothing to lose in Unix by falling back to prompt.sh, I'd like to bring > it > > into 7 and let the user choose. Maybe if the user is in Unix, there is no > > reason at all to use prompt.py? > > I'm not sure that we need a choice. Actually, I'm not sure that we > even need a separate script (in any language). $PROMPT_COMMAND can be > any bash command; it doesn't have to be an external program. We could > just insert the appropriate code as a bash function into the custom > <mapset>/.bashrc file generated by the startup script. > > IOW, in lib/init/grass.py, replace > > f.write("PROMPT_COMMAND=\"'%s'\"\n" % os.path.join(gisbase, 'etc', > 'prompt.py')) > > with > > f.write(""" > grass_prompt () { > LOCATION="`g.gisenv GISDBASE`/`g.gisenv LOCATION_NAME`/`g.gisenv MAPSET`" > if test -d "$LOCATION/grid3/G3D_MASK" && test -f "$LOCATION/cell/MASK" ; > then > echo [Raster and Volume MASKs present] > elif test -f "$LOCATION/cell/MASK" ; then > echo [Raster MASK present] > elif test -d "$LOCATION/grid3/G3D_MASK" ; then > echo [Volume MASK present] > fi > } > PROMPT_COMMAND=grass_prompt > """) > > -- > Glynn Clements <[email protected]> >
_______________________________________________ grass-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-dev
