DenoDDeno
Powered by
jeff.hykinJ
Denoβ€’3y agoβ€’
6 replies
jeff.hykin

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,
def somethin():
    func = two_hour_long_computation_with_hard_to_serialze_output()
    try:
        a = untested_code_1(func)
        b = untested_code_2(func)
        c = untested_code_3(func)
    except Exception as error:

        #### important bit: creates a repl   ####
        import code; code.interact(local={**globals(),**locals()})
        #### important bit ^                 ####

    save_results(a,b,c)
def somethin():
    func = two_hour_long_computation_with_hard_to_serialze_output()
    try:
        a = untested_code_1(func)
        b = untested_code_2(func)
        c = untested_code_3(func)
    except Exception as error:

        #### important bit: creates a repl   ####
        import code; code.interact(local={**globals(),**locals()})
        #### important bit ^                 ####

    save_results(a,b,c)

I then get a repl where I can poke around with the
a
a
,
b
b
,
error
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()
Deno.repl()
I know a hacky solution could be made in userland via
eval
eval
, but I wanted to check and see if there was an existing way
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,944Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

deno repl start time in container
benjamnBbenjamn / help
3y ago
repl
dan.the.discloserDdan.the.discloser / help
4y ago
comparable functionality to node:repl in deno?
j7m4Jj7m4 / help
16mo ago
[have workaround] "deno" and "deno repl" aren't producing output
benjamnBbenjamn / help
3y ago