Compare commits

..

No commits in common. "40e9624a98d433d2ea968695fc0fef88b9a15615" and "b93914b71fbd329c4bcb0f81c3bd9339bd0ba0d1" have entirely different histories.

2 changed files with 0 additions and 38 deletions

View File

@ -1,3 +0,0 @@
functioon g_kill_all_background_jobs {
kill -9 $(jobs -p)
}

View File

@ -1,35 +0,0 @@
function g_python {
unset g_python_result
g_tmp=/tmp
g_rnd=$$
# Use python in backround for multiple python commands running much faster
if [ -z "${g_python_running}" ]
then
mkdir -p ${g_tmp}/${g_rnd}
[ -p ${g_tmp}/${g_rnd}/python-in ] || mkfifo ${g_tmp}/${g_rnd}/python-in
[ -p ${g_tmp}/${g_rnd}/python-out ] || mkfifo ${g_tmp}/${g_rnd}/python-out
echo "while 1:
exec(open(\"${g_tmp}/${g_rnd}/python-in\").read())
" >${g_tmp}/${g_rnd}/python-pipeexec.py
# bc stream channel
{ python3 -u ${g_tmp}/${g_rnd}/python-pipeexec.py >${g_tmp}/${g_rnd}/python-out 2>&1 & }
g_python_running="true"
fi
# do python
local g_python_jobs
mapfile -t g_python_jobs < <(jobs -r)
if [[ $g_python_jobs =~ python-pipeexec.py ]]
then
echo $@ >${g_tmp}/${g_rnd}/python-in &
read -t 0.1 g_python_result <${g_tmp}/${g_rnd}/python-out
echo "RESULT: $g_python_result"
else
echo "FAIL: $g_python_result"
unset g_python_running
fi
}