Env predictor based on predictor of executed command

solve #3103
solve #2759
This commit is contained in:
Jean-Benoist Leger 2019-04-29 17:59:58 +02:00
parent 4f48345fa2
commit 7b3b026ef3
Failed to generate hash of commit

View file

@ -380,6 +380,15 @@ def predict_hg(args):
return not ns.interactive
def predict_env(args):
"""Predict if env is launching a threadable command or not"""
for i in range(len(args)):
if args[i] and args[i][0] != "-" and "=" not in args[i]:
return builtins.__xonsh__.commands_cache.predict_threadable(args[i:])
return True
def default_threadable_predictors():
"""Generates a new defaultdict for known threadable predictors.
The default is to predict true.
@ -395,6 +404,7 @@ def default_threadable_predictors():
"cmd": predict_shell,
"cryptop": predict_false,
"curl": predict_true,
"env": predict_env,
"ex": predict_false,
"emacsclient": predict_false,
"fish": predict_shell,