App terminal errors when calling Postgres from interactive shell
-
I am working in Elixir, and it uses bin/app_name remote in the terminal on cloudron to enter an interactive debugging shell (that concept exists similarly in other languages).
If I then click the postgres button, it adds this to the shell:
PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE}However, this command can't be run in the interactive shell, it errors out with a syntax error.
It's clear why this happens, but I think my user expectation would be to open a separate, overlay postgres shell at this point, do what I have to do in the database, and when quitting it, return to my previously opened shell.
Alternatively, there could be a cleaner error, e.g. "This command can't be run inside an interactive shell."
-
not exactly sure what "interactive shell" here means in your case, but this command line for postgres is really just a regular linux shell commandline. If elixir runs some other "shell" like repl, than this wil likely not work at all. Though why cant you just open a second terminal into the app in a new browser tab to run postgres cli?
-
To clarify: bin/app_name remote doesn't open a Linux shell at all. It attaches to the running Erlang VM and drops you into IEx, Elixir's interactive REPL (read-eval-print loop). At that prompt, you're not typing bash commands - you're typing Elixir expressions that get evaluated live against the running application (this is roughly equivalent to Rails' rails console, Django's manage.py shell, or Node's REPL).
So when the Postgres button injects a bash command like PGPASSWORD=... psql -h ..., IEx tries to parse it as Elixir syntax and understandably chokes.
Opening a second terminal tab works as a workaround, but from a UX perspective I'd expect one of two things instead:- The Postgres button detects that the current session is a language REPL (not a plain shell) and opens the psql command in a fresh terminal/tab automatically, or
- At minimum, a clearer error such as "This command requires a shell prompt, not an interactive REPL" instead of a raw syntax error.
I don't mind particularly if you choose not to act on this, I just keep running into the same issue, because my expectation as a user is different, so I felt like pointing this out.
-
that makes sense that it fails then. Issue here is that the webview has no real clue of what kind of process is running in the webterminal itself. So all that menu option really does is blindly pasting the hardcoded string into the tty. No clue on how to maybe fix this on some other level....
-
J joseph has marked this topic as solved
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login