Compare commits

...

3 Commits

Author SHA1 Message Date
9e0ca94fea devlog: finalized 2019-12-14 2019-12-14 18:31:45 +01:00
17ca848344 carp process: reading and writing works for one iteration 2019-12-14 18:22:23 +01:00
0711432f7e carp process: add new constructor 2019-12-14 17:10:15 +01:00
16 changed files with 73 additions and 2 deletions

View File

@@ -0,0 +1 @@
Im an exception that gets thrown when Carp does something funky.

View File

@@ -0,0 +1,3 @@
accessing
defaultAction
UnhandledError signalForException: self

View File

@@ -0,0 +1,3 @@
instance creation
from: anError
error := anError

View File

@@ -0,0 +1,14 @@
{
"commentStamp" : "VeitHeller 12/14/2019 17:49",
"super" : "Exception",
"category" : "Pond",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"parent",
"error"
],
"name" : "CarpException",
"type" : "normal"
}

View File

@@ -0,0 +1,3 @@
as yet unclassified
carp: aString
^ self new setCarp: aString

View File

@@ -0,0 +1,3 @@
accessing
died
^ excepted isNotNil

View File

@@ -1,3 +1,7 @@
initialization
initialize
proc := OSProcess command: 'carp'
proc := OSSUnixSubprocess new command: 'carp';
redirectStdin;
redirectStdout;
redirectStderr;
addAllEnvVariablesFromParentWithoutOverride

View File

@@ -0,0 +1,3 @@
accessing
isRunning
^ self died not and: proc pid; and: proc exitStatus isNil

View File

@@ -0,0 +1,3 @@
accessing
receiveErrorString
^ proc stderrStream upToEnd

View File

@@ -0,0 +1,3 @@
accessing
receiveString
^ proc stdoutStream upToEnd

View File

@@ -0,0 +1,3 @@
accessing
run
[ [ proc run ] on: Error do: [ :err | excepted := err ] ] fork

View File

@@ -0,0 +1,5 @@
accessing
sendString: aString
proc stdinStream nextPutAll: aString.
proc stdinStream close.
proc redirectStdin

View File

@@ -0,0 +1,3 @@
accessing
setCarp: aString
proc command: aString

View File

@@ -0,0 +1,3 @@
accessing
setDir: aString
proc environmentAt: 'CARP_DIR' put: aString

View File

@@ -6,7 +6,10 @@
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"proc"
"proc",
"out",
"in",
"excepted"
],
"name" : "CarpProcess",
"type" : "normal"

View File

@@ -15,3 +15,17 @@ Ill likely spend a lot of time hunting down the right API; I just
hope that it even exists.
## Review
Time worked: 1h30m
I got the basics of reading from Carp and writing to Carp working.
`OSProcess` turned out not to be what I need, instead Im now using
a library called `OSSubProcess` that has a way more powerful API and
better documentation.
Sadly `OSSubProcess` requires me to close the `stdin` stream after the
first chunk of writing to it. Im not sure whether I can reopen the
stream, it seems not to work. I filed [an issue on Github](https://github.com/pharo-contributions/OSSubprocess/issues/51),
but I suspect that this is actually not really fixable/not a use
case that they want to support. We will see. I gave up getting more
done for today.