[squeak-dev] Printing standard output from PipeableOSProcess on the Transcript

David T. Lewis lewis at mail.msen.com
Sun Jan 16 15:41:08 UTC 2022


On Sat, Jan 15, 2022 at 10:45:21PM -0500, David O'Toole wrote:
> Here you go, I made some demo vids with the progress bar and sounds :)
> https://www.youtube.com/watch?v=I4adAAyYWO8
> https://www.youtube.com/watch?v=Y-LNlHgOFeQ
> 

Hi David,

Here's an idea I thought of while watching the videos. If you want to
pre-populate the "Scheme executable" field in your Mosaic Instance Manager,
and you know that you're looking for a program called 'snd', then you
could use an OSProcess hack like this:


pathToExecutable: programName
	"Answer path to the a program, or empty string if not found"
	|rs|
	rs := (OSProcess outputOf: 'type ', programName) readStream.
	[rs atEnd or: [rs peek = FileDirectory pathNameDelimiter]]
		whileFalse: [rs next]. "skip leading verbiage"
	^ rs upTo: Character lf. "and trim trailing <lf>"

Dave



More information about the Squeak-dev mailing list