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

Working directory should be inherited from CLI #559

Closed cdlm closed 1 year ago

cdlm commented 2 years ago

Context: launching an image via CLI, using the pharo-launcher image launch IMAGENAME command

What happens: the working directory is the image directory (FileSystem disk workingDirectory = FileLocator imageDirectory asFileReference is true).

This is a problem because the user context is lost.

What should happen: the working directory (value of $PWD in the shell that invokes the pharo-launcher wrapper script) should be inherited by the image.

cdlm commented 2 years ago

See PhLLaunchImageProcessConfigurator >> visit:

visit
    process := PhLProcessWrapper new.
    process workingDirectory: self imageFile parent pathString.
    …

(a quick test after changing that seems to work, PR incoming)

Bajger commented 1 year ago

@cdlm Hi Damien! It's been a while since you did this change, but could you look at it? CI is failing after integration, see: https://ci.inria.fr/pharo-ci-jenkins2/job/PharoLauncher-Pipeline/job/feature%252Fcmd-line/18/console I think this is because workingDirectory on image launch configuration returns nil. Probably existing images have already referring to launch config objects:

PhLImage>>defaultLaunchConfiguration
    ^ launchConfigurations 
        detect: [ :each | each name = PhLLaunchConfiguration defaultName ]
        ifNone: [ PhLLaunchConfiguration defaultWithImage: self ]

probably existing image launch configuration instances need to be re-initialized with correct working directory. What do you think?

PharoLauncher-Pipeline » feature/cmd-line #18 Console [Jenkins]
Bajger commented 1 year ago

Waiting to CI to be up again. It should be fixed. by PR #604

Bajger commented 1 year ago

Resolved by linked PRs.