Closed jwaldmann closed 3 years ago
When I put the name of my repl: ... -- safe-tidal-cli, it gets started, but does not seem to be connected.
You also have to pass the host, session name and target name. By default, the host is "localhost", and the target name is "default", if not provided (maybe it should be called the same as the command, like "safe-tidal-cli"?)
For example, if your session token is ZGE3ZTZlOTktMTYxMS00Y2EwLTlmNzYtMGE1Zjk0NTE2N2Uz
:
flok-repl -s ZGE3ZTZlOTktMTYxMS00Y2EwLTlmNzYtMGE1Zjk0NTE2N2Uz -n tidal -- safe-tidal-cli
This will start safe-tidal-cli
and connect it as a "tidal" target.
btw safe-tidal-cli looks interesting!
Ah, I think I was missing -n tidal
. Also, the -h
text should mention -- <exec>
?
Coming back to my earlier question - I assume that the server sends, on each Ctrl-Enter in the client, the "block" that the cursor is in, where "block" contains the cursor position and extends (both ways) to next empty line.
flok-repl.js ... -- my-repl
then sends these blocks to stdin of my-repl
.
I want to detect end-of-block. Could you perhaps send an empty line after each block?
[EDIT] OK, done it myself - and it works!
write(body: string) {
- const newBody = this.prepare(body);
- this.repl.stdin.write(`${newBody}\n`);
+ const newBody : string = this.prepare(body);
+ this.repl.stdin.write(`${newBody}\n\n`);
Great! I fixed this on 4848629da49e67f885c57dca90523267e3e4bfbc
Hi. Does this still work?
I want to run https://github.com/jwaldmann/safe-tidal-cli#safe-tidal-cli but I am testing with cat
:
node packages/repl/bin/flok-repl.js -H wss://localhost:8000 -s mytoken -n tidal -N JW -- cat
but this gives me
Hub address: wss://localhost:8000
Session name: mytoken
Target name: tidal
Type: command
Notify messages to user named "JW"
Extra options: {}
Spawn 'undefined' with args: []
internal/validators.js:120
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received undefined
at validateString (internal/validators.js:120:11)
at normalizeSpawnArguments (child_process.js:406:3)
at Object.spawn (child_process.js:546:13)
at CommandREPL.start (/home/waldmann/software/music/flok/packages/repl/lib/repl.js:55:37)
at Object.<anonymous> (/home/waldmann/software/music/flok/packages/repl/bin/flok-repl.js:124:12)
at Module._compile (internal/modules/cjs/loader.js:1147:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:996:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
code: 'ERR_INVALID_ARG_TYPE'
}
That's a bug, will look into it.
Thanks, I appreciate it. I am planning to use flok in a lecture later this week. (So I should have started testing somewhat earlier, but you know how it is ...) If you don't find the time to debug - could you tell me where to look in the source?
@jwaldmann I think I fixed it now, can you try again? Do you need me to push a new version or are you using the cloned repo?
Using cloned repo. Test with "cat" works, so I assume it'll be fine with my repl - will test this later.
Thanks very much!
OK - works with my repl.
I am experimenting with an alternative repl ( https://github.com/jwaldmann/safe-tidal-cli )
So I have an executable that reads stdin (coming from the server) and writes to stdout and stderr (I want to send that to the server, so that GUI clients see it)
flok-repl.js -h
suggests--list-types
which all seem to have specific semantics. I don't want any (e.g., no:{
}:
. Just give me blocks of text.)The help text also suggests
flok-repl -- cat
so I am trying that but I am not seeing anything echoed.When I put the name of my repl:
... -- safe-tidal-cli
, it gets started, but does not seem to be connected.