Closed alkorsan closed 6 years ago
I think it is not a bug, when I remove exec in sh-c:"exec bash -c runscript" the version 1.0 works well
$ ./websocat_nossl_1.0_i686-pc-windows-gnu.exe ws://echo.websocket.org sh-c:"bash -c runscript"
Writing command to server
Reading response from server (assuming exactly one line)
Received response: first command
Writing command to server
Reading response from server (assuming exactly one line)
Received response: second command
Writing command to server
Reading response from server (assuming exactly one line)
Received response: third command
environment: line 9: kill: (1) - No such process
so I don't know what to say :)
Note that 1.0.0-alpha
has a bug in exec
/sh-c
specifier: if the executed program exits prematurely, it starts busy looping and draining memory.
The fix is in already master.
Also note that exec:
with arguments is now supported, unlike in 0.4.
./websocat_....exe ws://echo.websocket.org exec:bash --exec-args -c runscript
sh-c
(an alias of cmd:
) now uses cmd.exe
on Windows instead of just calling sh
unconditionally.
Do you think locking sh-c:
to sh
(and making only cmd:
choose the shell based on OS) is a good idea?
Thank you.
To answer your question I need to understand this:
1-cmd:
is not working in 0.4 and 1.0 , only sh-c:
works in cygwin, so I m not sure if it is an alias or something else...
$ ./websocat_nossl_1.0_i686-pc-windows-gnu.exe ws://echo.websocket.org cmd:'bash -c runscript'
ERROR 2018-06-20T00:23:50Z: websocat::specparse: Invalid specifier string `cmd:bash -c runscript`
websocat: Wrong specifier
2- why do we have exec: --exec-args
and sh-c:
? they seems to do the same thing!, and we already can use exec:cmd
so why a new cmd:
?
exec:
allows to specify array of command-line arguments without escaping level (probably unrelevant on Windows) and allows to launch the program directly without going though shell like sh
.
cmd: is not working in 0.4 and 1.0
Because of it's in post-1.0.0-alpha
master. I starting to forget what was in 1.0.0-alpha
and what is already fixed in master.
Maybe time to make a 1.0.0-beta
?
and allows to launch the program directly
then exec
is superior than sh-c:
/ cmd:
, because we can chose a shell if needed or run the command directly. then can I say that sh-c:
/ cmd:
is useless now?
I starting to forget what was in 1.0.0-alpha and what is already fixed in master.
I will attempt to compile from the master repository to see if cmd: works, if I can . I never used Rust before.
then can I say that sh-c: / cmd: is useless now?
It is often more convenient. See embedded examples on README or the long help message.
attempt to compile from the master repository
1.0.0-beta
is in progress of being built. Wait for half an hour and I'll publish it.
https://github.com/vi/websocat/releases/tag/v1.0.0-beta
Note that this sh-c:
vs cmd:
semantic is about to change.
Now with this update cmd:
works fine like sh-c:
. they seems identical, they both call cmd.exe
.
So I think making only cmd:
choose the shell based on OS is better, but in fact for me I prefer exec: because I can choose the shell and I still don t see any benefit in using cmd:/sh-c:
thank you
So I think making only cmd: choose the shell based on OS is better
because if we are in cygwin/bash shell then we don t need cmd.exe , and if we are in cmd.exe shell and don t have bash.exe then we need to run cmd.exe obligatory.
and having sh-c:
run cmd.exe is useless , we never need cmd in cygwin/bash world thanks to God :)
I still don t see any benefit in using
cmd:
Simply less typing / concise command lines. Compare
websocat -E - exec:/bin/sh --exec-args -c 'for i in `seq 0 4`; do echo $i; done'
and
websocat -E - cmd:'for i in `seq 0 4`; do echo $i; done'
Hi, First I want to thank you for this gem. thank you very much.
The new version v1.0.0-alpha can't parse the args well, the old version 0.4 works well!. I m using cygwin in windows 7.
using this exemple : https://stackoverflow.com/questions/48912184/wscat-commands-from-script-how-to-pass/48914019#48914019
the new version gaves this error
using the old version 0.4 everything works fine:
the version 0.5 too have problems, but seems a different error:
thank you.