-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
in npx dash-wasm: after the cat command, subsequent commands have problems with stdout #49
Comments
(in browser, commands work correctly)(but with 1 extra error message) (cowasm)$ cat wrongname1
cat: wrongname1: No such file or directory
(cowasm)$ cat wrongname1
cat: wrongname1: No such file or directory
cat: stdout: Bad file descriptor
(cowasm)$ echo skfjdsf
skfjdsf
(cowasm)$ echo $PATH
/usr/bin:.
(cowasm)$ python
Python 3.11.0 (main, Nov 29 2022, 20:26:05) [Clang 15.0.3 ([email protected]:ziglang/zig-bootstrap.git 0ce789d0f7a4d89fdc4d9571 on wasi
Type "help", "copyright", "credits" or "license" for more information.
>>> fhgfh
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'fhgfh' is not defined
|
(in a built dash, and using only the cat from the tar package, no errors)I have built only dash and the tar package (contains also cpio and cat). EDIT ...
git clone ...
cd ...
make
...
cd ~/cowasm/
./bin/dash-wasm-raw -ex
# maybe a better invocation is something like
npx kernel dash
# note: but /cowasm does not exist
cd packages
cd tar
cd dist
cd wasm
cd bin
ls -l
./cat wrongname1
...
|
The problem might just be that I haven't finished implementing all error handling paths in dash. The original dash uses setjmp/longjmp for error handling. However, those don't exist in WASM (except via the not-pretty asyncify), so I'm basically rewriting dash to not use them by instead passing back error codes. I did this in some cases, but not everywhere yet. Fortunately, the source code of dash is relatively easy to understand :-). If you know C, and want to help with this, I can give you some pointers. (Cowasm is BSD licensed, so your contributions are to a fully open source project. I'm having to take a break for a bit from very active cowasm development to catch up on a bunch of other things.) |
Ok, I will just now add the remaining 2 mentioned experiments ... for completeness, and then I will read your comment again. |
LATER: bin/cat from fs.zip ... errors even when I bypassed dash-wasm ... when I ran it from npx kernel dash ( // 2023-01 BTW, cat.c contains
|
LATER: the built ./cat from the tar package ... works ok even when I ran it from npx dash-wasm (https://github.com/libarchive/libarchive/blob/master/cat/bsdcat.c) // BTW, I didn't find there anything like
|
I suspected, that after the end of the Experiment: cd ~/10-cowasm/node_modules/dash-wasm
npx dash-wasm -x
python
import os, sys
os.fstat(1)
quit()
os.stat_result(st_mode=8640, st_ino=3, st_dev=98, st_nlink=1, st_uid=0, st_gid=0, st_size=0, st_atime=1673941490, st_mtime=1673941488, st_ctime=1673880218) cat anyname1
cat anyname1
echo abc
python
import os, sys
x=os.fstat(1)
print(x, file=sys.stderr)
os.stat_result(st_mode=8640, st_ino=0, st_dev=0, st_nlink=1, st_uid=0, st_gid=0, st_size=0, st_atime=1673941624, st_mtime=1673941624, st_ctime=1673941624) I plan to learn how to use the DEBUG env var ... https://www.npmjs.com/package/debug |
(a probably related issue: #42 )
// error when I used dash-wasm that was installed by npm
(in browser, commands work correctly)
(but with 1 extra error message)
EDIT I have cut this chapter into a comment
(in a built dash, and using only the cat from the tar package, no errors)
EDIT I have cut this chapter into a comment
LATER: bin/cat from fs.zip ... errors even when I bypassed dash-wasm ... when I ran it from npx kernel dash
in a comment
LATER: the built ./cat from the tar package ... works ok even when I ran it from npx dash-wasm
in a comment
The text was updated successfully, but these errors were encountered: