Migrating functinoality from OSSubprocess to GtSubprocess.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-08-22 17:02:32 -05:00
parent 45dee962af
commit 1378d854c4
3 changed files with 18 additions and 36 deletions

View File

@ -11,10 +11,7 @@ Brew class >> install [
For example, doing 'sudo -S base-devel' on Arch based systems or For example, doing 'sudo -S base-devel' on Arch based systems or
'brew intall gcc' is yet not managed here." 'brew intall gcc' is yet not managed here."
Smalltalk os isWindows ifTrue: [ ^ nil ]. Smalltalk os isWindows ifTrue: [ ^ nil ].
OSSUnixSubprocess new ^ (GtSubprocessWithInMemoryOutput new
shellCommand: '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'; shellCommand: '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"';
redirectStdout; runAndWait)
runAndWaitOnExitDo: [ :command :outString |
^ outString
].
] ]

View File

@ -46,12 +46,12 @@ NanoID class >> install [
Nimble install: 'nanoid'. Nimble install: 'nanoid'.
Smalltalk os isWindows Smalltalk os isWindows
ifTrue: [ ^ LibC resultOfCommand: 'nanoid c ',self scriptSourceCode fullName ]. ifTrue: [ ^ LibC resultOfCommand: 'nanoid c ',self scriptSourceCode fullName ].
OSSUnixSubprocess new GtSubprocessWithInMemoryOutput new
command: 'nim'; shellCommand: 'nim c ', self scriptSourceCode fullName;
arguments: {'c'. self scriptSourceCode fullName}; runAndWait;
runAndWaitOnExitDo: [ :process :outString | stdout.
(self scriptSourceCode parent / (self scriptSourceCode) basenameWithoutExtension) moveToPageTitled: MiniDocs appFolder asFileReference. self scriptSourceCode parent / (self scriptSourceCode) basenameWithoutExtension moveToPageTitled: MiniDocs appFolder asFileReference.
^ MiniDocs appFolder ] ^ MiniDocs appFolder
] ]
{ #category : #accessing } { #category : #accessing }

View File

@ -22,20 +22,11 @@ Nimble class >> install: packageName [
self installPackagesList. self installPackagesList.
Smalltalk os isWindows Smalltalk os isWindows
ifTrue: [ ^ LibC runCommand: 'nimble install ', packageName ]. ifTrue: [ ^ LibC runCommand: 'nimble install ', packageName ].
OSSUnixSubprocess new ^ (GtSubprocessWithInMemoryOutput new
command: 'nimble'; shellCommand: 'nimble install ', packageName;
arguments: {'install'. runAndWait;
packageName}; stdout)
redirectStdout;
redirectStderr;
runAndWaitOnExitDo: [ :process :outString :errString |
process isSuccess
ifTrue: [ Transcript show: 'Command exited correctly with output: ', outString. ]
ifFalse: [
^ 'Command exit with error status: ', process exitStatusInterpreter printString, String cr,
'Stderr contents: ', errString.
]
]
] ]
{ #category : #accessing } { #category : #accessing }
@ -66,16 +57,10 @@ Nimble class >> installed [
output. output.
^ process stdout lines ]. ^ process stdout lines ].
OSSUnixSubprocess new ^(GtSubprocessWithInMemoryOutput new
command: 'nimble'; shellCommand: 'nimble list --installed';
arguments: #('list' '--installed'); runAndWait;
redirectStdout; stdout)
redirectStderr;
runAndWaitOnExitDo: [ :process :outString :errString |
process isSuccess
ifTrue: [ ^ outString lines ];
ifFalse: [ ^ nil ]
]
] ]
{ #category : #accessing } { #category : #accessing }