From 1378d854c4feb209af539d43cc8effba31d10563 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Thu, 22 Aug 2024 17:02:32 -0500 Subject: [PATCH] Migrating functinoality from OSSubprocess to GtSubprocess. --- src/ExoRepo/Brew.class.st | 9 +++------ src/ExoRepo/NanoID.class.st | 12 ++++++------ src/ExoRepo/Nimble.class.st | 33 +++++++++------------------------ 3 files changed, 18 insertions(+), 36 deletions(-) diff --git a/src/ExoRepo/Brew.class.st b/src/ExoRepo/Brew.class.st index 283906e..bd33b3d 100644 --- a/src/ExoRepo/Brew.class.st +++ b/src/ExoRepo/Brew.class.st @@ -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 - shellCommand: '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'; - redirectStdout; - runAndWaitOnExitDo: [ :command :outString | - ^ outString - ]. + ^ (GtSubprocessWithInMemoryOutput new + shellCommand: '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'; + runAndWait) ] diff --git a/src/ExoRepo/NanoID.class.st b/src/ExoRepo/NanoID.class.st index a73756f..ee18cf7 100644 --- a/src/ExoRepo/NanoID.class.st +++ b/src/ExoRepo/NanoID.class.st @@ -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 } diff --git a/src/ExoRepo/Nimble.class.st b/src/ExoRepo/Nimble.class.st index b661653..8896d48 100644 --- a/src/ExoRepo/Nimble.class.st +++ b/src/ExoRepo/Nimble.class.st @@ -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 }