Xonsh aliasesįor my xonsh-specific solution I went with an alias function. This would have to be done for any tool that uses. ~/.xonshrc or your calling shell's configuration file: # Prepend to PATH SHELL=/bin/bash exec /usr/bin/ssh make it executable ( chmod +x ~/bin/ssh). One approach would be to add a wrapper script early in the PATH which sets SHELL correctly: ![]() For these examples I assume that my ssh_config uses bash syntax and I want to call it from xonsh, but it should be equally possible to use any combination of incompatible shells. I believe the only option is to choose one shell and make sure that any way of launching ssh sets $SHELL correctly. I have been unable to find a way to force a particular shell from within ssh config files. Note that I can't work around this by calling a different shell inside the exec command because the string quoting still is performed by the outside shell, which may change depending on the current value of $SHELL. I would have to use r'123\.' to disable quoting. In xonsh, this syntax is illegal due to python string quoting rules. The single quotes force raw string interpretation, so the slashes are passed to egrep. I have the following in my ssh config: match !exec "ifconfig | egrep -q 'inet (123\.45\.|67\.89\.)'" ![]() Note that this is executed with the local shell and is not related to which shell runs on the remote server. Is there a way to force ssh to pass the exec command to a specific shell rather than using the user's shell? I use two shells with fairly different syntax (zsh and xonsh) which makes it difficult to write one exec statement that works equally well on both. Commands containing whitespace characters must be quoted. If the command returns a zero exit status then the condition is considered true. The exec keyword executes the specified command under the user's shell. (Specifically, I change my ProxyJump based on my IP address). Subprocess mode looks a bit like Bash 1, but it also has big differences. Python mode is just Python with a few extras. Switching between modes is usually implicit, but can be forced. ⬇️ Please click the □ reaction instead of leaving a +1 or □ commentįile "C:\Users\auneri1\Miniconda3\envs\shell2\lib\site-packages\xonsh\built_ins.py", line 571, in _run_binaryįile "C:\Users\auneri1\Miniconda3\envs\shell2\lib\subprocess.py", line 800, in _init_įile "C:\Users\auneri1\Miniconda3\envs\shell2\lib\subprocess.py", line 1207, in _execute_childįile "C:\Users\auneri1\Miniconda3\envs\shell2\lib\site-packages\xonsh\proc.py", line 1889, in _init_įile "C:\Users\auneri1\Miniconda3\envs\shell2\lib\site-packages\xonsh\built_ins.py", line 560, in runįile "C:\Users\auneri1\Miniconda3\envs\shell2\lib\site-packages\xonsh\built_ins.py", line 587, in _run_binary xonsh has Python mode and subprocess mode which have different syntax. There seem to be other issues associated with this change - I'll file separate bugs for them. I tried zsh for a while, but the amount of configuration necessary is painful, and I kept running into 1. It was working fine prior to those changes. In general, its better to move them into xonsh (from a perfomance perspective), but again, we can probably cache this in future. I recently upgraded from Python 3.7 to 3.8, as well as the Xonsh version from 0.8.x to 0.9.21. In fact, the text even changes color when I type 'rg' which shows that xonsh is recognizing this as a valid command in the path. The above is an example with ripgrep (rg). : xonsh: subprocess mode: command not found: rg Proc = n(pipeline_group=pipeline_group)įile "C:\Users\me\AppData\Roaming\Python\Python38\site-packages\xonsh\built_ins.py", line 550, in runįile "C:\Users\me\AppData\Roaming\Python\Python38\site-packages\xonsh\built_ins.py", line 577, in _run_binary Hp, ht, pid, tid = _winapi.CreateProcess(executable, args,įileNotFoundError: The system cannot find the file specifiedĭuring handling of the above exception, another exception occurred:įile "C:\Users\me\AppData\Roaming\Python\Python38\site-packages\xonsh\proc.py", line 1889, in _init_ ![]() Self._execute_child(args, executable, preexec_fn, close_fds,įile "c:\program files\python38\lib\subprocess.py", line 1307, in _execute_child P = self.cls(self.cmd, bufsize=bufsize, **kwargs)įile "C:\Users\me\AppData\Roaming\Python\Python38\site-packages\xonsh\proc.py", line 584, in _init_įile "c:\program files\python38\lib\subprocess.py", line 854, in _init_ Xonsh: To log full traceback to a file set: $XONSH_TRACEBACK_LOGFILE = įile "C:\Users\me\AppData\Roaming\Python\Python38\site-packages\xonsh\built_ins.py", line 561, in _run_binary
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |