From 0e28e55c8e469dcee9c5e0f15adb85f0c7af612c Mon Sep 17 00:00:00 2001 From: rsteube Date: Wed, 18 Nov 2020 19:38:12 +0100 Subject: [PATCH] xonsh: fix empty callback result --- example/cmd/root_test.go | 7 +++++-- xonsh/snippet.go | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/example/cmd/root_test.go b/example/cmd/root_test.go index 25d63e235..f79f25173 100644 --- a/example/cmd/root_test.go +++ b/example/cmd/root_test.go @@ -940,8 +940,11 @@ def _example_completer(prefix, line, begidx, endidx, ctx): stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() cb = cb.decode('utf-8') - nonlocal prefix, line, begidx, endidx, ctx - return eval(cb) + if cb == "": + return {} + else: + nonlocal prefix, line, begidx, endidx, ctx + return eval(cb) if False: pass diff --git a/xonsh/snippet.go b/xonsh/snippet.go index 1f106299e..681f75770 100644 --- a/xonsh/snippet.go +++ b/xonsh/snippet.go @@ -86,8 +86,11 @@ def _%v_completer(prefix, line, begidx, endidx, ctx): stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() cb = cb.decode('utf-8') - nonlocal prefix, line, begidx, endidx, ctx - return eval(cb) + if cb == "": + return {} + else: + nonlocal prefix, line, begidx, endidx, ctx + return eval(cb) if False: pass%s