jeff.hykin
`deno compile` offline [Solved]
- I've got a sandbox (the nix packaging system requires it)
- I run
deno compile a.js
outside the sandbox. Works fine.
- I copy $HOME/.cache/deno
into the sandbox
- I copy $TMP
into the sandbox
- I download denort-x86_64-unknown-linux-gnu.zip
and copy it into the sandbox
- (I don't know where to put it)
- I run deno compile a.js
in the sandbox (no internet permissions) and get:
- error sending request for url (https://dl.deno.land/release/v1.44.4/denort-x86_64-unknown-linux-gnu.zip)
Where can I put the denort.zip where deno will find it?3 replies
deno_core manual tick/poll
(Learning the ropes of deno_core)
Two related questions:
- If I create a JsRuntime, and call
poll_event_loop
manually. Do I still fundamentally need tokio to be running?
- I'd like to have a rust code execute in parallel/collaboration with a single embedded deno runtime. E.g. pure rust code in a secondary thread passes a task to the main thread deno runtime. Both the pure rust and deno run in parallel. The difficulty is then, the rust side, at some point, needs to grab a lock and pause the deno runtime. Meaning the deno tick loop also needs to be grabbing a lock on every tick (or grabbing a lock for a group of ticks for better throughput). After acquiring the lock, the pure rust side would then check the status of tasks in the deno runtime, give deno runtime more things to eval, then release the lock and let it start ticking away again. Aside from the natural difficultly of rust and threading, is this realistic? Or is there some tokio/inter-threading problems missing from my mental model1 replies
Sync Child Stdin Read
I'd like to make a JS wrapper around the repl of another language.
For example:
I can spawn a repl in a subprocess, keep it open and hook into the stdin/out/err of it. Then the idea would be to do something like the following:
The problem is something like that^ needs to run inside of a getter for
console.log(b.a)
to work. E.g. no async.
I can do some incredibly hacky work, like funneling stdout to a file and then sync-reading (.seek()) the file over and over. But surely there's a better way.
Relevant documentation on streams:
https://deno.land/api@v1.38.5?s=ReadableStreamBYOBReader5 replies
Deno Repl Programmatically
Python has a really nice not-well-known tool for creating a repl at any point in the code (kinda like a debugger but without any need for all the debugging setup). For example,
I then get a repl where I can poke around with the
a
, b
, error
vars, fix them and when I exit the repl it resumes execution (saving the output to disk so that I don't have to wait another 2 hours)
Is there a way to do this in Deno? e.g. some unstable/hidden Deno.repl()
I know a hacky solution could be made in userland via eval
, but I wanted to check and see if there was an existing way7 replies
Deno.run Strange Issue
I use
Deno.run
+ stdout/signals/etc a lot, but this behavior is beyond my current debugging abilities
I have a command nix eval ...
which works fine in a python subshell, and on the commandline. However, Deno.run with piped stdout makes it hang indefinitely. To be explicit, in this block: process.status().then(callback).catch(callback)
the callback doesn't run until a .kill()
is used (SIGHUP/SIGINT/SIGKILL). Tested on Deno 1.29.4 and Deno 1.22.0 for good measure.
What is even more strange is trying to bypass the problem with hackery also fails.
All of these round-about execution methods (translated to Deno.run) also hang indefinitely:
- bash -c '[command]'
- bash ./file_with_command.sh
- bash -i ./file_with_command.sh
In particular the bash -i
method not only hangs, but also exclusively makes it so that ctrl+C, ctrl+D, and even ctrl+Z are ignored; I have to kill the deno process from another termial.
Env: bash -c env
prints out the EXACT same env vars for Deno/Python/CLI
Cwd: deno/python/cli all have the same working directory
Interactivity: running it with deno repl
has been the same as deno run
Piping:
Manually closing the stdout pipe doesn't work/help.
Removing stdout: 'piped'
, makes command not-hang (but defeats the point).
Adding stderr: 'piped'
still causes a hang.
I don't even know what else could be possibly causing a difference (Deno & Python code attached as comments)8 replies
Publishing Deno Module with Bin (Answered)
I know there's a way to include a
bin/
when publishing a module and then perform some kind of deno install https://module-url
because I've used it before. But now that I'm searching for it, "bin", "executable", and the like only turn up docs on deno compile
. I remeber there was an example installing curl.ts (https://deno.land/std@0.168.0/examples/curl.ts) but I can't seem to find that example either. Could someone point me in the right direction?2 replies
How to cancel or abort .pipeTo()?
I prefer not asking, but after I found (what I consider) an MDN easter egg, I realized this is probably not something I'm going to solve without help from runtime-implementers. https://user-images.githubusercontent.com/17692058/200146738-da3e8747-6c7f-4ec7-adb8-fbb8c8947d33.png
The example is straightforward, call
stream1.pipeTo(stream2)
then, with full access to both stream1
and stream2
try to shutdown/cancel/close/abort/sabotage/nuke stream1, stream2 or even just the pipe itself (copy-paste example below). The big issue is that, because of the pipeTo
the deno process never ends. I've tried absolutely everything I can think of, including inheriting from WritableStream, prototype pollution hacks, accessing probably-shouldnt-be-accessed-directly-symbol keys, etc and I've not got a hint of success
4 replies