pharo-project / pharo-launcher

Lets you manage your pharo images and download new ones
https://pharo-project.github.io/pharo-launcher/
MIT License
109 stars 46 forks source link

Does not spawn images with tcsh using login shell #360

Open maenu opened 5 years ago

maenu commented 5 years ago

We noticed an issue when using launcher with tcsh on MacOS. The $SHELL is set to /bin/tcsh, the default setting in launcher seems to be use login shell. Then it creates a command like /bin/tcsh -l -c <pharo> <image>, but tcsh only allows -l when used as the only argument (see https://linux.die.net/man/1/tcsh).

The current behavior in this situation is as follows: Launching an image does nothing, no image spawns, no message is given. One thing to fix is to make sure that early crashes of launches are captured and the stderr/stdout is presented as a warning to the user. That way at least one knows what happened and the launcher gives feedback on why things failed.

Another thing to fix is to treat tcsh properly. Assuming that the shell supports -l -c is wrong, as this example shows. Each shell should be treated differently, maybe a setting for setting the shell to use in the launcher would also be helpful.

maenu commented 5 years ago

The code sections to look are:

PhlImage>>launchWithSettings:
PhLProcessWrapper>>runUnwatch
PhLProcessWrapper>>prepareLinuxProcess
OSSUnixSubprocess>>loginShellCommand:
Incorrectly applies -l and -c to the result of:
OSSUnixSubprocess>>shellCommand
Incorrectly uses the environment’s SHELL variable
which might not support -l -c
as is the case with tcsh
maenu commented 5 years ago

As a workaround, disabling the setting "Use login shell" works with tcsh, but still, the launcher should not just fail silently when launching an image in the described case with the login shell. At least it should give an error message with the command and stderr/out.