Run a shell command, and capture output in variable?

19 views
Skip to first unread message

Ross Merrifield

unread,
Dec 29, 2022, 12:10:45 PM12/29/22
to dylan-lang
Dylan-lang users,

I am new to Dylan, and I would like to create a simple program to gain a better understanding of the language. The intended program will be a simple wrapper around a shell command. The command-line parser library gets me half way there, but I haven't been able to find a method to run a shell command and capture the output in a variable.

Can this be accomplished in Open Dylan? I have 2020.1 currently installed, but I'll probably install 2022.1 monetarily.  I'm running on Windows 10 64bit if it matters.

Thanks,

Ross

Ross Merrifield

unread,
Dec 29, 2022, 12:15:13 PM12/29/22
to dylan-lang
Correction: 2022.1 is already installed, not sure why I thought I had 2020

Peter Housel

unread,
Dec 30, 2022, 1:41:04 AM12/30/22
to dylan-lang
Yes, it can. The code at https://github.com/dylan-lang/opendylan/blob/5603ebe3e93f694ad457403842c17fa56168823a/sources/system/tests/operating-system.dylan#L106 is one of the unit tests for the run-application function, from the operating-system module of the system library. The documentation for that function can be found at https://opendylan.org/documentation/library-reference/system/operating-system.html#system:operating-system:run-application (though it isn't very complete).

-Peter-

Ross Merrifield

unread,
Dec 30, 2022, 12:48:16 PM12/30/22
to dylan-lang
Thanks Peter, that looks like a good starting point for me.

Ross

Carl Gay

unread,
Dec 31, 2022, 9:13:49 AM12/31/22
to Peter Housel, dylan-lang
--
You received this message because you are subscribed to the Google Groups "dylan-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dylan-lang+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dylan-lang/16a598db-7ee7-4dd3-b219-a25fe02b258en%40googlegroups.com.

Carl Gay

unread,
Mar 28, 2023, 4:29:35 PM3/28/23
to dylan-lang
Reply all
Reply to author
Forward
0 new messages