Comments (11)
Hey! Nice catch! Thanks!
Workaround:
xonsh --no-rc
$f = p'/tmp/file.tmp'
echo 'abc' > $f
from xonsh.
Thank you very much for workaround and for this awesome shell!
from xonsh.
@Kossak-esky I made the fix. Please test:
xpip install -U --force-reinstall git+https://github.com/xonsh/xonsh@fix_redirect_to_subst
# restart xonsh
f = p'/tmp/file.tmp'
echo 'abc' > @(f)
cat @(f)
# abc
from xonsh.
It works, except cat < @(f)
but I don't need this one (just tested it out of curiosity) and I understand it's not supported yet anyway.
Thank you!
from xonsh.
This works as well:
f = p'/tmp/file.tmp'
echo 'abc' > @(f)
cat < @(f)
# abc
from xonsh.
ok, it turns out it doesn't work when I have coreutils
xontrib enabled.
This works:
kossak@lman3 ~ @ xonsh@fix2 --no-rc
kossak@lman3 ~ @ f = p'/tmp/file.tmp'
echo 'abc' > @(f)
cat < @(f)
abc
But when I create .xonshrc
with body:
from xonsh.xontribs import xontribs_load
xontribs = [
'coreutils',
]
xontribs_load(xontribs)
I get error:
kossak@lman3 ~ @ xonsh@fix2
kossak@lman3 ~ @ f = p'/tmp/file.tmp'
echo 'abc' > @(f)
cat < @(f)
abc
xonsh: For full traceback set: $XONSH_SHOW_TRACEBACK = True
OSError: [Errno 9] Bad file descriptor
from xonsh.
With traceback:
kossak@lman3 ~ @ f = p'/tmp/file.tmp'
echo 'abc' > @(f)
cat < @(f)
abc
xonsh: To log full traceback to a file set: $XONSH_TRACEBACK_LOGFILE = <filename>
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
File "/home/kossak/.local/pipx/venvs/xonsh@fix2/lib/python3.9/site-packages/xonsh/built_ins.py", line 211, in subproc_captured_hiddenobject
return xonsh.procs.specs.run_subproc(cmds, captured="hiddenobject", envs=envs)
File "/home/kossak/.local/pipx/venvs/xonsh@fix2/lib/python3.9/site-packages/xonsh/procs/specs.py", line 957, in run_subproc
return _run_specs(specs, cmds)
File "/home/kossak/.local/pipx/venvs/xonsh@fix2/lib/python3.9/site-packages/xonsh/procs/specs.py", line 999, in _run_specs
cp.end()
File "/home/kossak/.local/pipx/venvs/xonsh@fix2/lib/python3.9/site-packages/xonsh/procs/pipelines.py", line 465, in end
self._end(tee_output=tee_output)
File "/home/kossak/.local/pipx/venvs/xonsh@fix2/lib/python3.9/site-packages/xonsh/procs/pipelines.py", line 478, in _end
self._set_input()
File "/home/kossak/.local/pipx/venvs/xonsh@fix2/lib/python3.9/site-packages/xonsh/procs/pipelines.py", line 576, in _set_input
stdin.seek(0)
OSError: [Errno 9] Bad file descriptor
from xonsh.
It's fixed in the PR, just update - #5420 (comment)
from xonsh.
I did update it, but somehow it still doesn't work when I have coreutils loaded. Without coreutils it works fine.
[kossak@lman3 ~]$ xonsh@fix2
kossak@lman3 ~ @ xpip install -U --force-reinstall git+https://github.com/xonsh/xonsh@fix_redirect_to_subst
Collecting git+https://github.com/xonsh/xonsh@fix_redirect_to_subst
Cloning https://github.com/xonsh/xonsh (to revision fix_redirect_to_subst) to /tmp/pip-req-build-b5arx8xv
Running command git clone --filter=blob:none --quiet https://github.com/xonsh/xonsh /tmp/pip-req-build-b5arx8xv
Running command git checkout -b fix_redirect_to_subst --track origin/fix_redirect_to_subst
Switched to a new branch 'fix_redirect_to_subst'
branch 'fix_redirect_to_subst' set up to track 'origin/fix_redirect_to_subst'.
Resolved https://github.com/xonsh/xonsh to commit e4a6f4f75720203a5df71484f12fcbb997d0b052
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: xonsh
Building wheel for xonsh (pyproject.toml) ... done
Created wheel for xonsh: filename=xonsh-0.16.0-py39-none-any.whl size=618295 sha256=2c458fa6bb7bb57eca07b399be8fc287b8dd78d6b2505778f18041531e6c338c
Stored in directory: /tmp/pip-ephem-wheel-cache-6lmd98_2/wheels/a2/ae/ce/309e0bc4c48c4f47153e136a2f071614cb1db1ec4563533df3
Successfully built xonsh
Installing collected packages: xonsh
Attempting uninstall: xonsh
Found existing installation: xonsh 0.16.0
Uninstalling xonsh-0.16.0:
Successfully uninstalled xonsh-0.16.0
Successfully installed xonsh-0.16.0
kossak@lman3 ~ @ xonsh@fix2
kossak@lman3 ~ @ xonfig
+-----------------------------+------------------------------------------------+
| xonsh | 0.16.0.dev114 |
| Git SHA | e4a6f4f7 |
| Commit Date | May 16 15:43:13 2024 |
| Python | 3.9.16 |
| PLY | 3.11 |
| have readline | True |
| prompt toolkit | 3.0.43 |
| shell type | prompt_toolkit |
| history backend | json |
| pygments | 2.18.0 |
| on posix | True |
| on linux | True |
| distro | unknown |
| on wsl | False |
| on darwin | False |
| on windows | False |
| on cygwin | False |
| on msys2 | False |
| is superuser | False |
| default encoding | utf-8 |
| xonsh encoding | utf-8 |
| encoding errors | surrogateescape |
| xontrib 1 | argcomplete |
| xontrib 2 | coreutils |
| xontrib 3 | navi |
| xontrib 4 | abbrevs |
| xontrib 5 | fzf-widgets |
| xontrib 6 | vox |
| xontrib 7 | voxapi |
| RC file 1 | /home/kossak/.xonshrc |
| RC file 2 | /home/kossak/.config/xonsh/rc.d/asdf.xsh |
| RC file 3 | /home/kossak/.config/xonsh/rc.d/cdf.xsh |
| RC file 4 | /home/kossak/.config/xonsh/rc.d/gcp.xsh |
| RC file 5 | /home/kossak/.config/xonsh/rc.d/kubernetes.xsh |
| RC file 6 | /home/kossak/.config/xonsh/rc.d/local_all.xsh |
| RC file 7 | /home/kossak/.config/xonsh/rc.d/local_home.xsh |
| RC file 8 | /home/kossak/.config/xonsh/rc.d/local_work.xsh |
| RC file 9 | /home/kossak/.config/xonsh/rc.d/ssh.xsh |
| UPDATE_OS_ENVIRON | False |
| XONSH_CAPTURE_ALWAYS | False |
| XONSH_SUBPROC_OUTPUT_FORMAT | stream_lines |
| THREAD_SUBPROCS | True |
| XONSH_CACHE_SCRIPTS | True |
+-----------------------------+------------------------------------------------+
kossak@lman3 ~ @ f = p'/tmp/file.tmp'
echo 'abc' > @(f)
cat < @(f)
abc
xonsh: For full traceback set: $XONSH_SHOW_TRACEBACK = True
OSError: [Errno 9] Bad file descriptor
kossak@lman3 ~ @ xonsh@fix2 --no-rc
kossak@lman3 ~ @ f = p'/tmp/file.tmp'
echo 'abc' > @(f)
cat < @(f)
abc
kossak@lman3 ~ @
from xonsh.
I tried clean installation, that shows that loading coreutils break things:
[kossak@lman3 ~]$ pipx install --python /home/kossak/.asdf/installs/python/3.9.16/bin/python --suffix=@fix3 'git+https://github.com/xonsh/xonsh@fix_redirect_to_subst'
installed package xonsh 0.16.0 (xonsh@fix3), installed using Python 3.9.16
These apps are now globally available
- xonsh-cat@fix3
- xonsh-uname@fix3
- xonsh-uptime@fix3
- xonsh@fix3
done! ✨ 🌟 ✨
[kossak@lman3 ~]$ xonsh@fix3 --no-rc
kossak@lman3 ~ @ f = p'/tmp/file.tmp'
echo 'abc' > @(f)
cat < @(f)
abc
kossak@lman3 ~ @ xontrib list
coreutils not-loaded
kossak@lman3 ~ @ xontrib load coreutils
kossak@lman3 ~ @ xontrib list
coreutils loaded manual
kossak@lman3 ~ @ f = p'/tmp/file.tmp'
echo 'abc' > @(f)
cat < @(f)
abc
xonsh: For full traceback set: $XONSH_SHOW_TRACEBACK = True
OSError: [Errno 9] Bad file descriptor
kossak@lman3 ~ @
from xonsh.
"Bad file descriptor" looks like #4792. Thank you for reporting. Feel free to create separate issue about coreutils if it's not 4792.
from xonsh.
Related Issues (20)
- Run tests: `fixture 'xession' not found use 'pytest --fixtures [testpath]' for help on them.` HOT 1
- conda and mamba: `DeprecationWarning: Use xonsh.lib.lazyasd instead of xonsh.lazyasd.` HOT 1
- What is changed after releasing new resolver? HOT 2
- Windows: Comapre typing speed: xonsh 0.16.0 vs 0.18.2 HOT 29
- [docs] Cli command examples in guides should be fully copy&pasteable, i.e., without @
- Completion exception when input ends with `@(` HOT 2
- AUTO_CD broken on 0.18.2 HOT 2
- problems importing case_insensitive_dict HOT 10
- Callable alias can provoke `Bad file descriptor` exception in the internal or external code HOT 21
- git completion only lists the files in the directory, not the commands and the files.
- install from homebrew on macos: Python Icon Jumping on the Dock HOT 8
- $XONSH_SUBPROC_OUTPUT_FORMAT affects downstream apps HOT 1
- Callable alias with subproc commands: upstream redirect ignored in downstream command redirect
- Edge case: callable alias with full capturing and redirect in the middle: `I/O operation on closed file`
- Callable alias: redirect inside uncaptured operator produces `AttributeError: 'int' object has no attribute 'readable'`
- Windows: No backscroll in Python REPL when running under xonsh HOT 5
- Color highlighting sometimes fails on fast typing
- Unexpected numerical token HOT 1
- Variables shadowing executables should be highlighted green
- installation and configuration options for NixOS HOT 2
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.