Skip to content

Commit

Permalink
GtShellScriptProcess: don't assume bash location
Browse files Browse the repository at this point in the history
  • Loading branch information
akgrant43 committed Oct 21, 2024
1 parent 8c3a392 commit 1ea82b7
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/Lepiter-Snippet-Shell/GtShellScriptProcess.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,38 @@ Class {
'bindings',
'onSuccess'
],
#classVars : [
'BashExecutable'
],
#category : #'Lepiter-Snippet-Shell'
}

{ #category : #accessing }
GtShellScriptProcess class >> bashExecutable [

^ BashExecutable ifNil: [ BashExecutable := self findBashExecutable fullName ]
]

{ #category : #private }
GtShellScriptProcess class >> findBashExecutable [
"Answer the path to the specified executable.
Run this is a shell as some platforms, e.g. Mac, don't set up the same environment for processes started from the file explorer."

^ GtOsSystemInfo current findExecutable: 'bash'.
]

{ #category : #initialization }
GtShellScriptProcess class >> initialize [

SessionManager default registerSystemClassNamed: self name.
]

{ #category : #initialization }
GtShellScriptProcess class >> startUp: resuming [

resuming ifTrue: [ BashExecutable := nil ]
]

{ #category : #private }
GtShellScriptProcess >> announce: announcement [
self announcer announce: announcement
Expand Down Expand Up @@ -224,7 +253,7 @@ GtShellScriptProcess >> newShellScriptBuilder [
arg: '-c' ]
ifFalse: [
GtExternalProcessBuilder new
command: '/bin/bash';
command: self class bashExecutable;
arg: '-c' ]
]

Expand Down

0 comments on commit 1ea82b7

Please sign in to comment.