pylon icon indicating copy to clipboard operation
pylon copied to clipboard

Terminal closes immediately after opening when `bash` does not exist in PATH

Open darkuranium opened this issue 11 months ago • 5 comments

I'm trying out the IDE, but I ran into a trouble with opening the terminal --- it immediately closes.

I've managed to spot an error message which sometimes flashes for just 1 frame: "No such file or directory". Following that rabbit hole, I ultimately found the problem to be the implicit assumption in various places in the code on bash existing (which does not exist by default in FreeBSD).

I think two things would be useful here:

  1. Make the default shell configurable in configs/*; for example, I personally prefer mksh to bash. A potential hack is to use ln -s /usr/local/bin/mksh ~/.local/bin/bash, but that feels ... wrong.
  2. Output an actual error/warning when opening the terminal itself fails (whether in log or in UI), it would help narrow down the problem.

darkuranium avatar Jan 09 '25 13:01 darkuranium

I've ran into this as well when trying out on different OS configurations, indeed the bash hardcoding is limiting and should be configurable. If invalid configuration is set, there should be a warning/error surfaced to the userland.

exsilium avatar Jan 10 '25 08:01 exsilium

I'm trying out the IDE, but I ran into a trouble with opening the terminal --- it immediately closes.

I've managed to spot an error message which sometimes flashes for just 1 frame: "No such file or directory". Following that rabbit hole, I ultimately found the problem to be the implicit assumption in various places in the code on bash existing (which does not exist by default in FreeBSD).

I think two things would be useful here:

1. Make the default shell configurable in `configs/*`; for example, I personally prefer mksh to bash.
   A potential hack is to use `ln -s /usr/local/bin/mksh ~/.local/bin/bash`, but that feels ... wrong.

2. Output an actual error/warning when opening the terminal itself fails (whether in log or in UI), it would help narrow down the problem.

where is this called?

Kreijstal avatar Jan 10 '25 11:01 Kreijstal

where is this called?

https://github.com/pylonide/pylon/blob/9d238f89ace40413e4e29676bcf3340c2cfae555/plugins-server/pylon.ide.terminal/terminal.js#L23

exsilium avatar Jan 10 '25 11:01 exsilium

where is this called?

https://github.com/pylonide/pylon/blob/9d238f89ace40413e4e29676bcf3340c2cfae555/plugins-server/pylon.ide.terminal/terminal.js#L23

Note also https://github.com/pylonide/pylon/blob/9d238f89ace40413e4e29676bcf3340c2cfae555/plugins-server/pylon.ide.search/search.js#L156

Plus there are a ton of places where bash is hardcoded in plugins-client:

$ grep -r 'bash' plugins-client
plugins-client/lib.ace/www/worker/worker-language.js:        command: "bash",
plugins-client/lib.ace/www/worker/worker-language.js:        argv: ["bash", "-c", command],
plugins-client/lib.ace/www/mode/mode-slim.js:        bash: require("./sh").Mode,
plugins-client/lib.ace/www/mode/mode-markdown.js:        bash: require("./sh").Mode,
plugins-client/ext.linereport/linereport_base.js:        command: "bash",
plugins-client/ext.linereport/linereport_base.js:        argv: ["bash", "-c", command],
plugins-client/pylon.core/www/core/util.js:    "bash": "application/x-sh",
plugins-client/ext.gotofile/search.js:    "pl": 1, "pm": 2, "ps1": 1, "cfm": 1, "sql": 2, "sh": 1, "bash": 1,

(some like "bash": "application/x-sh" are obviously false positives here, bu tmany are not)

darkuranium avatar Jan 10 '25 12:01 darkuranium

the lib.ace/* hits are bleeding in from the Ace editor. Other hits are part of this project.

exsilium avatar Jan 10 '25 12:01 exsilium