Skip to content

define_editor should default to wait=true #55579

Open
@jyn514

Description

(i want to prefix this by saying @miguelraz describes all my bugs as "your setup stuff is in like the .000001% of germs that pure alcohol doesn’t kill neighborhood")


define_editor in editless.jl has the following comment:

By default julia does not wait for the editor to close, running it in the
background. However, if the editor is terminal based, you will probably want to
set `wait=true` and julia will wait for the editor to close before resuming.

the comment is accurate; define_editor is defined as function define_editor(fn::Function, pattern; wait::Bool=false). this is a really weird default. using @edit with any unrecognized terminal editor will freeze the repl indefinitely; there are also weirder bugs like #53321.

why was this default chosen? i think wait=true is a much better default; almost all editors either wait, if they run in the terminal, or exit almost immediately if they open a window (e.g. code, xdg-open).

steps to replicate

  1. echo 'exec "$EDITOR" "$@"' > my-editor
  2. chmod +x my-editor
  3. JULIA_EDITOR=./my-editor julia
  4. @edit ""[1]
  5. the REPL freezes indefinitely. you have to kill it, e.g. with ctrl-z. even worse, if you manage to exit the editor (since it has taken over stdin, and most likely switched the terminal into canonical mode), signals will not be handled correctly, and you will need to kill it from another terminal, since this one is completely unresponsive.

meta info

julia> versioninfo()
Julia Version 1.9.1
Commit 147bdf428cd (2023-06-07 08:27 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 × AMD Ryzen 7 7700X 8-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, znver3)
  Threads: 1 on 16 virtual cores
Environment:
  JULIA_EDITOR = hx-hax

i installed julia through apt on popOS, which claims julia is Version: 1.9.1pop1~1686756697~22.04~8c30437

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    stdlibJulia's standard library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions