Skip to content

Commit

Permalink
Make PBPharoPipenvPathFinder class>>#macOSSearchPath a bit more robust [
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvc committed Oct 21, 2024
1 parent 56a91b3 commit 2cedbef
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/PythonBridge-Pharo/PBPharoPipenvPathFinder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,14 @@ PBPharoPipenvPathFinder class >> extraPathNonWindows [
PBPharoPipenvPathFinder class >> macOSSearchPath [
"Try starting a login shell to pick up a wider PATH"

| shell envOutput env pathValue |
| shell envOutput pathValue |
shell := Smalltalk os environment at: 'SHELL' ifAbsent: [ ^ #() ].
envOutput := (GtExternalProcessBuilder new
command: shell;
args: #('-l' '-c' 'env');
args: #('-l' '-c' 'env | grep -E ''^PATH=''');
output) stdoutString.
env := (envOutput lines
collect: [ :line | ($= split: line) in: [ :parts | parts first -> parts second ] ])
asDictionary.
pathValue := env at: #PATH ifAbsent: [ ^ #() ].
envOutput isEmpty ifTrue: [ ^ #() ].
pathValue := ($= split: envOutput lines first) second.
^ $: split: pathValue
]

Expand Down

0 comments on commit 2cedbef

Please sign in to comment.