Adding yq support to Windows platform.

This commit is contained in:
Paula Martinez 2024-04-03 17:10:01 -05:00
parent 6832d9024d
commit 642712cdfd
1 changed files with 10 additions and 6 deletions

View File

@ -33,12 +33,16 @@ 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 OSSUnixSubprocess new
shellCommand: 'cat ', jsonFile fullName,' | yq -y'; shellCommand: 'cat ', jsonFile fullName,' | yq -y';
redirectStdout; redirectStdout;
runAndWaitOnExitDo: [ :command :outString | runAndWaitOnExitDo: [ :command :outString |
^ outString ^ outString
]. ]].
Smalltalk os isWindows
ifTrue: [ ^ LibC resultOfCommand: 'yq -p=json ', jsonFile fullName ].
] ]
{ #category : #accessing } { #category : #accessing }