#Streaming command output

1 messages · Page 1 of 1 (latest)

wicked fiber
#

Can you share more details on what you're trying to achieve?

tender zealot
#

I want to get this url if i run this command in a container and want to send this for automation via api or any furthur code or through curl or cli or anything
and it is from this docs and vs code server feature https://code.visualstudio.com/docs/remote/tunnels
@wicked fiber can you guide to solve this because this is the only roadblock for our implementation.

#

@wicked fiber i have updated the link, please check again

tender zealot
#

Any possibility?

wicked fiber
#

I see, so the tool is a long-running service, and it prints https://vscode.dev/tunnel/<xxxx> where <xxxx> is a different tunnel name each time? And you need to get that value out to share it to clients.

So, ideally there would be a way to break down this command into 2 commands: one that returns immediately with the URL; and another to actually serve the tunnel. That would be the easiest.

#

Short of that, you could try something like 1) creating a private cache volume; 2) running code tunnel as a service while redirecting the output to a file in the cache volume, 3) in parallel, run a script in another container, with the same private cache volume mounted, that waits for the file to appear, and reads its output, searches for the URL, and prints that.

#

Maybe there's another hack I can't think of? @patent sail @solar furnace @jolly quiver

solar furnace
#

Not currently at my computer so I can't check, but in the docs there seems to be an option for tunnel called --name: https://code.visualstudio.com/docs/editor/command-line#_create-remote-tunnel. Is that flag the value of the last part of the path maybe?

In the screenshot it says "penguin". Sounds randomly generated? If it's possible to specify a value then you can manually build the url and return it

Visual Studio Code command-line interface (switches).

#

Not necessarily a hack but if name works like that then it should work!

tender zealot
tender zealot
wicked fiber
#

you neee to create a custom type called perhaps Tunnel, with a function like start(): Tunnel that forces starting the service, and another function endpoint that calls start() then returns the static url.