Comments (3)
@yaxollum thank you for the fast answer! Hmmm, okay, I will revert the revert - #5475 :)
from xonsh.
Hi @yaxollum!
I found that the commit that did breaking changes:
Please take a look and add more tests (I'm using this for test). Thanks!
Also I see that command echo 1 > file
becomes ['echo', '1', ('>',), 'file']
in _flatten_cmd_redirects(cmd)
maybe this is the cause of None error.
I'm using this to find regress:
# Checkout every commit and test command
$RAISE_SUBPROC_ERROR=True
mkdir -p /tmp/xonsh_dev
cd /tmp/xonsh_dev
git clone https://github.com/xonsh/xonsh
cd xonsh
xonsh_bin = ["python", "-m", "xonsh", "--no-rc"]
commits = [(c.split(' ', 1)[0], c.split(' ', 1)[1]) for c in $(git log '43c9aaf..' --reverse --oneline)]
for hash, descr in commits:
printx(f"{{YELLOW}}{hash} {descr[:80]!r}{{RESET}}")
_ = $(git checkout -f @(hash))
@(xonsh_bin) -V
# Check regress
@(xonsh_bin) -c "echo 123 > @('/tmp/file')"
# 08ac0d97 'Fix parsing of redirect tokens (#5322)'
# Previous HEAD position was 7461c507 Fix incorrect IOREDIRECT tokens in Python mode (#5013)
# HEAD is now at 08ac0d97 Fix parsing of redirect tokens (#5322)
# xonsh/0.15.1
# Traceback (most recent call last):
# File "/private/tmp/xonsh_dev/xonsh/xonsh/procs/specs.py", line 179, in safe_open
# return open(fname, mode, buffering=buffering)
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# TypeError: expected str, bytes or os.PathLike object, not NoneType
from xonsh.
Hi @anki-code , thanks for investigating this issue! The reason why the @()
operator outputs a list is that it can produce multiple arguments. For example:
echo @(['hello','world'])
# Output: hello world
echo @(['a','b'])@(['c','d'])
# Output: ac ad bc bd
I don't think it's possible to fix this issue in the parser because in some cases we only know the length of the list at runtime:
mylist = ['a']
echo hello > @(mylist) # should redirect output to file 'a'
mylist = ['a', 'b', 'c']
echo hello > @(mylist) # should produce an error since we cannot output to multiple files
Considering this, I think the fix that you provided in #5423 is probably the best solution.
from xonsh.
Related Issues (20)
- Process and subprocess
- Refactoring: parser
- Refactoring: operators
- Refactoring: aliases
- Faded blue color HOT 1
- Warlus in python substitution: NamedExpr target must be a Name
- Edge case: `TERM=dumb xonsh -i` hangs indefinitely if stdin is non-interactive
- Edge case: `xonsh --no-rc --no-env`: `TERM environment variable not set`
- Windows: case of commands is incorrectly upper-cased on Windows HOT 7
- Completion: `act, _, value = act_res`: `Exception too many values to unpack (expected 3)` HOT 1
- Windows: Don't imply PATH=. HOT 7
- Edge case: `source file.xonshrc` shows `attempting to source non-xonsh file`
- Piping into the process that was ended immediately leads to exceptions with descriptors HOT 1
- Disable loading xonshrc in xonsh pytest plugin HOT 1
- Unintended loading `xonshrc` file in script mode HOT 15
- Colorize stderr
- Windows: support windows paths in environment HOT 1
- Refactoring: review interactive functionality
- Macs and Next don't have a login shell HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xonsh.