Standard UNIX shell sh(1) is unsupported
I cannot use /bin/sh as a foreign-shell on NetBSD.
For community
⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment
The same applies for csh(1) and ksh(1). Is xonsh just for the BASH family?
What setup are you using to interface with these foreign shells? the interface should work if you supply the correct information, but we do not yet have sensible defaults for these. Any help on that front would be great to have!
The following config:
{
"foreign_shells": [
{
"shell": "ksh"
}
]
}
Gives me this result:
$ xonsh
Traceback (most recent call last):
File "/usr/pkg/bin/xonsh", line 3, in <module>
main()
File "/usr/pkg/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 16689, in main
args = premain(argv)
File "/usr/pkg/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 16674, in premain
builtins.__xonsh_shell__ = Shell(**shell_kwargs)
File "/usr/pkg/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 16424, in __init__
kwargs.get('cacheall', False))
File "/usr/pkg/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 16468, in _init_environ
debug_level=debug)
File "/usr/pkg/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 16099, in __init__
load_builtins(execer=self, config=config, login=login, ctx=xonsh_ctx)
File "/usr/pkg/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 15938, in load_builtins
builtins.__xonsh_env__ = env = Env(default_env(config=config, login=login))
File "/usr/pkg/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 11544, in default_env
issue_warning=False)
File "/usr/pkg/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 8603, in load_foreign_envs
shenv, _ = foreign_shell_data(**shell)
File "/usr/pkg/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 8306, in foreign_shell_data
shkey = CANON_SHELL_NAMES[shell]
File "/usr/pkg/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 214, in __getitem__
return obj[item]
KeyError: 'ksh'
I think there might be at least a fallback for a shell without detected extra features.
For example with ksh(1) I can list functions with:
$ typeset -f
fun() {
echo
}
ll() {
ls -l ${1+"$@"}
}
$ typeset +f
fun
ll
But it's impossible (according to my knowledge) to do the same with our sh(1). C-Shell is a special case anyway and for another thread (also I'm not a user of it).
These three shells are rather traditional UNIX trio preinstalled in the default settings.
I think there might be at least a fallback for a shell without detected extra features.
Well, I am not sure there is a generic fallback since we span the range from cmd.exe to zsh. I think erroring out here is better than a silent failure or a warning.
But it's impossible (according to my knowledge) to do the same with our sh(1)
Yeah, in which case the funcname part would simply have to return an empty JSON object string.
Any help getting more of the foreign shells implemented would be most appreciated.
Please specify detailed things and I can try to help.
Well, for every foreign shell that we want to support by default, the mappings at the top of foreign_shells.py here should have corresponding entries. The documentation for these entries is described here: http://xon.sh/xonshconfig.html#foreign-shells
The tricky ones are the aliases and func commands. As you noted, the func commands may not always be available, and so the entry should just punt.
Of course, as available, tests should also be provided. Probably in tests/foreign_shells.py. Feel free to ask any questions!