Using GtSubprocess instead of OSSubprocess. Will backporting this to "plain" Pharo be a future issue?

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-05-19 11:47:59 -05:00
parent c01d31a2a9
commit 5de6a81029
14 changed files with 626 additions and 630 deletions

View File

@ -42,16 +42,12 @@ YQ class >> jsonToYaml: aDictionary [
| jsonFile | | jsonFile |
self binaryFile exists ifFalse: [ YQ install]. self binaryFile exists ifFalse: [ YQ install].
jsonFile := MarkupFile exportAsFileOn: FileLocator temp / 'data.json' containing: aDictionary. jsonFile := MarkupFile exportAsFileOn: FileLocator temp / 'data.json' containing: aDictionary.
(Smalltalk os isUnix or: [ Smalltalk os isMacOS ])
ifTrue: [
OSSUnixSubprocess new
shellCommand: 'cat ', jsonFile fullName,' | yq -y';
redirectStdout;
runAndWaitOnExitDo: [ :command :outString |
^ outString
]].
Smalltalk os isWindows Smalltalk os isWindows
ifTrue: [ ^ LibC resultOfCommand: 'yq -p=json ', jsonFile fullName ]. ifTrue: [ ^ LibC resultOfCommand: 'yq -p=json ', jsonFile fullName ].
^ GtSubprocessWithInMemoryOutput new
shellCommand: 'cat ', jsonFile fullName,' | yq -y';
runAndWait;
stdout
] ]
{ #category : #accessing } { #category : #accessing }