Running OS commands

52 views
Skip to first unread message

Louis LaBrunda

unread,
May 10, 2024, 4:06:06 PMMay 10
to VAST Community Forum
Hi All,

I would like to add the ability to run OS commands to two of my programs that run on a Raspberry Pi.  This would be from one of the web browser pages I use to change settings.  I have used OsProcessStarter.  I would like to use it and capture the output of the executed command and display it.  There are options for sending the output to a file or pipe.  Can I capture the output in an object with a pipe or is that just for sending it to another program?  Can the output be piped back into my Smalltalk program?.  Or do I need to send the output to a file and read the file?

Lou

Mariano Martinez Peck

unread,
May 13, 2024, 10:52:53 AMMay 13
to va-sma...@googlegroups.com
Hi Louis, 

Not sure if I fully understood your question but can't you simply do something like this (notice the last line):

processStarter := OsProcessStarter command: ....
process := processStarter start.
process waitForCompletion.
process outputStream upToEnd inspect 


Regards,



--
You received this message because you are subscribed to the Google Groups "VAST Community Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to va-smalltalk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/e856d20c-4ea4-4406-bb14-89f2bec276ben%40googlegroups.com.


--

Mariano Martinez Peck

VAST Team Lead

Senior Software Engineer

 mp...@instantiations.com
 @MartinezPeck
 /mariano-martinez-peck
 instantiations.com
TwitterLinkedInVAST Community ForumGitHubYouTubepub.dev

Louis LaBrunda

unread,
May 13, 2024, 12:22:07 PMMay 13
to VAST Community Forum
Hi Mariano,

Thanks for the reply.  Basically, I want to make an area of a web page look like a window like cmd.exe would give you.  This is sort of like VNC but just Windows or Linux commands.

When I use "process waitForCompletion.", the process never ends and I have to break into it.

When I try this:

| com process |
com := OsProcessStarter command: #('c:\Windows\System32\cmd.exe' 'dir').
process := com start.
(Delay forSeconds: 2) wait.
process outputStream upToEnd inspect.

I always get the same thing:

'Microsoft Windows [Version 10.0.19045.4355]
(c) Microsoft Corporation. All rights reserved.

C:\VASTPlatform V13.0.0\images64\WiFiClock>'

Lou

Seth Berman

unread,
May 13, 2024, 12:36:14 PMMay 13
to VAST Community Forum
Greetings Lou,

Invoking cmd.exe the way you are doing it starts and interactive session which is not going to terminate.
Hint: Use the /C argument (Carries out the command specified by string and then terminates)

| process |

process := OsProcessStarter start: #('c:\Windows\System32\cmd.exe' '/c' 'dir').

process waitForCompletion.
process outputStream upToEnd inspect


- Seth

Louis LaBrunda

unread,
May 13, 2024, 4:00:03 PMMay 13
to VAST Community Forum
Hey Seth,

Thanks for the reply.  That solves the problem of the wait not ending and it captures the output.

I don't think I can reproduce the Windows/Linux command terminal but I don't think I need to.  My cousin has a copy of the clock program and for a while there was some question as to if she could use VNC, so I was looking for a way around it.  I now think that she can use the free RealVNC viewer.  I think I will still implement the ability to execute a single command and get the results.

I will keep the group informed.

Lou

Reply all
Reply to author
Forward
0 new messages