|
From: | Paolo Bonzini |
Subject: | Re: [Help-smalltalk] call shell commands; synchronous return |
Date: | Tue, 08 Apr 2008 14:59:35 +0200 |
User-agent: | Thunderbird 2.0.0.12 (Macintosh/20080213) |
So here is what I wanted to do: " Part 1: shut down running VMWare VMs" shellCmd := '/usr/bin/vmrun list'. pipe := FileStream popen: shellCmd dir: FileStream read. pipe linesDo: [: vmName | shellCmd2 := '/usr/bin/vmware-cmd %1 stop' bindWith: vmName. pipe2 := FileStream popen: shellCmd2 dir: FileStream read. ]Hence the need for a synchronous call so that the script waits until each machine is shut down.
Do you need the output of the second command? If no, obviously you can use popen for the outer loop and system for the inner loop. Otherwise, closing a pipe or sending it #contents will also wait for the process to end.
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |