Subprocess without job control spew
# If you don't want to have [3] and [3]+ Done and all that stuff:
( (do_some_work_here; do_some_more)& )
# or
( just_do_some_work arg arg arg & )
# E.g. from bithon.
# Write to a fd (which is a named pipe) all of the arguments
# to the function then write a special end of stream statement.
# Do all this in the background (to avoid pipe deadlock) and
# launch from a subshell to avoid job control spew. Remember
# fork on Linux (or Mac OS) is < 1000 cycles... i.e. less than
# one millionth of a second, so don't worry too much about this
# approach from a performance point of view (though subshells
# are actually quite a bit more expensive).
( (echo "$@" >&3; echo 'print "\nbithon-eos"' >&3)& )
# Putting the background process in a subshell removes the job control spew.
( (do_some_work_here; do_some_more)& )
# or
( just_do_some_work arg arg arg & )
# E.g. from bithon.
# Write to a fd (which is a named pipe) all of the arguments
# to the function then write a special end of stream statement.
# Do all this in the background (to avoid pipe deadlock) and
# launch from a subshell to avoid job control spew. Remember
# fork on Linux (or Mac OS) is < 1000 cycles... i.e. less than
# one millionth of a second, so don't worry too much about this
# approach from a performance point of view (though subshells
# are actually quite a bit more expensive).
( (echo "$@" >&3; echo 'print "\nbithon-eos"' >&3)& )
# Putting the background process in a subshell removes the job control spew.
Comments
Post a Comment