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
'brew intall gcc' is yet not managed here."
Smalltalk os isWindows ifTrue: [ ^ nil ].
OSSUnixSubprocess new
^ (GtSubprocessWithInMemoryOutput new
shellCommand: '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"';
redirectStdout;
runAndWaitOnExitDo: [ :command :outString |
^ outString
].
runAndWait)
]

View File

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

View File

@ -22,20 +22,11 @@ Nimble class >> install: packageName [
self installPackagesList.
Smalltalk os isWindows
ifTrue: [ ^ LibC runCommand: 'nimble install ', packageName ].
OSSUnixSubprocess new
command: 'nimble';
arguments: {'install'.
packageName};
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.
]
]
^ (GtSubprocessWithInMemoryOutput new
shellCommand: 'nimble install ', packageName;
runAndWait;
stdout)
]
{ #category : #accessing }
@ -66,16 +57,10 @@ Nimble class >> installed [
output.
^ process stdout lines ].
OSSUnixSubprocess new
command: 'nimble';
arguments: #('list' '--installed');
redirectStdout;
redirectStderr;
runAndWaitOnExitDo: [ :process :outString :errString |
process isSuccess
ifTrue: [ ^ outString lines ];
ifFalse: [ ^ nil ]
]
^(GtSubprocessWithInMemoryOutput new
shellCommand: 'nimble list --installed';
runAndWait;
stdout)
]
{ #category : #accessing }