mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
integrated lexer split into $(cmd)
This commit is contained in:
parent
4030ed8050
commit
a8224d29a2
2 changed files with 24 additions and 2 deletions
17
news/lex.rst
Normal file
17
news/lex.rst
Normal file
|
@ -0,0 +1,17 @@
|
|||
**Added:**
|
||||
|
||||
* The lexer has a new ``split()`` method which splits strings
|
||||
according to xonsh's rules for whitespace and quotes.
|
||||
|
||||
**Changed:** None
|
||||
|
||||
**Deprecated:** None
|
||||
|
||||
**Removed:** None
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* The ``@$(cmd)`` operator now correctly splits strings according to
|
||||
xonsh semantics, rather than just on whitespace using ``str.split()``.
|
||||
|
||||
**Security:** None
|
|
@ -839,8 +839,13 @@ def subproc_captured_stdout(*cmds):
|
|||
|
||||
def subproc_captured_inject(*cmds):
|
||||
"""Runs a subprocess, capturing the output. Returns a list of
|
||||
whitespace-separated strings in the stdout that was produced."""
|
||||
return [i.strip() for i in run_subproc(cmds, captured='stdout').split()]
|
||||
whitespace-separated strings of the stdout that was produced.
|
||||
The string is split using xonsh's lexer, rather than Python's str.split()
|
||||
or shlex.split().
|
||||
"""
|
||||
s = run_subproc(cmds, captured='stdout')
|
||||
toks = builtins.__xonsh_execer__.parser.lexer.split(s)
|
||||
return toks
|
||||
|
||||
|
||||
def subproc_captured_object(*cmds):
|
||||
|
|
Loading…
Add table
Reference in a new issue