Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
`rad config edit` errors if `$EDITOR` has args
Closed { reason: Solved } did:key:z6Mko5mi...bgMH opened 1 year ago
$ printenv VISUAL
emacs --no-window-system

$ rad config edit
✗ Error: No such file or directory (os error 2)

$ rad version
rad 1.0.0-rc.13 (unknown)

This is because radicle_cli::commands::rad_config::run doesn’t handle the result of radicle_term::editor::default_editor() like a shell command, but handles it as the pathname of an executable.

This is unlike radicle_term::editor::Editor::edit which does handle the result of default_editor() like a shell command.

Maybe rad_config::run should instead use Editor::edit, to reuse its “handles like a shell command”? But that would involve working with a temp file and having to write the returned contents of that back to the $RAD_HOME/config.json.

Or maybe the “handle editor value like a shell command” functionality should be factored-out, so that rad_config::run (and potentially other things) could reuse that for editing a file directly (without a temp file)?

fintohaps commented 1 year ago

Thanks for the suggestion! I implemented this here1, so I’ll mark this is as solved :)

If it comes up again, feel free to open the issue back up and let me know what went wrong.

1

https://app.radicle.xyz/nodes/seed.radicle.xyz/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5/commits/0d402647cb2eb98e4fc97c3a60ab3c6cba9152d0#radicle-cli/src/commands/config.rs:H1L15