Comments (17)
Thanks a lot! I also submitted an AUR package and will keep maintaining it. Hopefully that'll increase popularity of this useful tool.
from sexpect.
For now send -file
only accepts a regular file. send
sets a limit and at most 1024 bytes can be sent so it need to check the file size before reading. It cannot get the file size of a named pipe.
What's the benefit of using a named pipe in your use case?
from sexpect.
Same as in the link in the description. I want to be able to pass <(dmenu -P)
as an argument.
from sexpect.
OK. Let me see if I can remove the regular file check.
from sexpect.
Another useful (somewhat related) thing would be to allow specifying -
for -file
to accept data from stdin. In both cases (named pipe and stdin) the 1024b limit can still be preserved, discarding everything else beyond that.
from sexpect.
May be like this:
send -file FILE [-limit COUNT]
- FILE can be
-
which means stdin. - If
-limit COUNT
is not specified, FILE must be a regular file of size ≤ 1024. - COUNT in range [1, 1024].
- FILE can be
send -fd FD -limit COUNT
-limit
must be specified with-fd
.- COUNT in range [1, 1024].
The idea is to make the behavior more explicit rather than silently discarding data so users would not be surprised.
from sexpect.
Yeah, I think that's great.
from sexpect.
It's now available on the "devel" branch. Will merge to "master" after the doc is updated and tests are added.
from sexpect.
That's impressive, thanks! Testing it now:
$ ./sexpect -s /tmp/sp.sock send -fd <(dmenu) -limit 32
[ERROR] invalid number: /dev/fd/63
Probably makes sense to accept paths as well, not just fd by number?
from sexpect.
When I'm trying to use stdio, I have to hit extra Enter to make dmenu pop up:
./sexpect -s /tmp/sp.sock send -file - -limit 32 | dmenu
from sexpect.
That's impressive, thanks! Testing it now:
$ ./sexpect -s /tmp/sp.sock send -fd <(dmenu) -limit 32 [ERROR] invalid number: /dev/fd/63
Probably makes sense to accept paths as well, not just fd by number?
Shell's <(cmd)
is not a FD. It's a pathname, as is /dev/fd/63
in the error message.
from sexpect.
When I'm trying to use stdio, I have to hit extra Enter to make dmenu pop up:
./sexpect -s /tmp/sp.sock send -file - -limit 32 | dmenu
sexpect's send
sub-command is not supposed to output any meaningful data. It makes little sense to pipe the output to another command. According to your previous comments, you may want this:
./sexpect -s /tmp/sp.sock send -file <(dmenu) -limit 32
# OR
./sexpect -s /tmp/sp.sock send -fd 0 -limit 32 < <(dmenu)
# OR
dmenu | ./sexpect -s /tmp/sp.sock send -fd 0 -limit 32
from sexpect.
Shell's
<(cmd)
is not a FD. It's a pathname, as is/dev/fd/63
in the error message.
Yeah, this is what I'm saying. Maybe accept FD paths as well here?
from sexpect.
sexpect's
send
sub-command is not supposed to output any meaningful data. It makes little sense to pipe the output to another command. According to your previous comments, you may want this:./sexpect -s /tmp/sp.sock send -file <(dmenu) -limit 32 # OR ./sexpect -s /tmp/sp.sock send -fd 0 -limit 32 < <(dmenu) # OR dmenu | ./sexpect -s /tmp/sp.sock send -fd 0 -limit 32
Yeah, sorry, I mismatched the commands. This worked:
$ dmenu <&- | ./sexpect -s /tmp/sp.sock send -cr -file - -limit 32
from sexpect.
Shell's
<(cmd)
is not a FD. It's a pathname, as is/dev/fd/63
in the error message.Yeah, this is what I'm saying. Maybe accept FD paths as well here?
Ignore this. Given that you removed regular file check, as you said in your previous comment -file
works perfectly with a path:
$ ./sexpect -s /tmp/sp.sock send -file <(dmenu) -cr -limit 32
from sexpect.
Yep, see my previous comment. I think all is good now and works as expected designed.
from sexpect.
Merged to master: https://github.com/clarkwang/sexpect/releases/tag/v2.3.12
from sexpect.
Related Issues (20)
- The option "-zombie-ttl N" does not work as expected HOT 2
- Add test for "-zombie-idle N"
- [v2.3.4] issue with "-zombie-idle" HOT 1
- [v2.3.7] interact -re PATTERN: detach upon matching a specified pattern HOT 2
- [v2.3.7-dev] 2 issues with "interact -re"
- Implement "interact_out" like in Expect? HOT 2
- Don't run the specified command as session leader? HOT 1
- cmake: add "make install" support HOT 2
- [v2.3.8] 0.4% CPU usage on macOS 11.6 (32GB Mem) HOT 1
- syntax error: unexpected "(" HOT 3
- [v2.3.10] "-nonblock on": don't drop data too quickly HOT 1
- [v2.3.9] Add version check when the client connects to the server HOT 1
- [v2.3.11] New subcommand "get -expect-buf N": dump data in the internal expect buffer HOT 2
- [doc] get -expect-buf
- Release missing tags HOT 1
- [v2.3.13] interact -subst PATTERN::REPLACE HOT 1
- [v2.3.14] add a new cli option to enable "regcomp(cflags|=REG_NEWLINE)"
- Add testcases for v2.3.12..v2.3.14
- option to discard color codes & al 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 sexpect.