Terminate a process in a Win32Shell

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Terminate a process in a Win32Shell

Arushi Aggarwal
Hi all,

I have one squeak image bring up another squeak image to run a script.
I have the following code in my workspace.

shell1 := Win32Shell new.
t := [s := shell1 shellExecute:f lpOperation:'open'
lpFile:'Squeak.exe' lpParameters:'Squeak3.10.2-7179-basic.image
project-files/testNone.sh none' lpDirectory:'' nShowCmd:1.] .

r = t fork.

I wish to be able to kill the squeak.exe process being run from the shell.

r terminate does not seem to do that.

Any pointers to what I should use.

Thanks in advance.

Arushi

Reply | Threaded
Open this post in threaded view
|

Re: Terminate a process in a Win32Shell

Chris Muller-3
Hi Arushi,

> r = t fork.

Even if you corrected this assignment, you would only have a Smalltalk
"Process" object, which only terminates processes running in or above
the interpreter; they have nothing to do with OS processes.

To control OS processes, check out OSProcess.

As an alternative, you may wish to exit the other image gracefully.

 - Chris



On Tue, Apr 13, 2010 at 9:16 PM, Arushi Aggarwal <[hidden email]> wrote:

> Hi all,
>
> I have one squeak image bring up another squeak image to run a script.
> I have the following code in my workspace.
>
> shell1 := Win32Shell new.
> t := [s := shell1 shellExecute:f lpOperation:'open'
> lpFile:'Squeak.exe' lpParameters:'Squeak3.10.2-7179-basic.image
> project-files/testNone.sh none' lpDirectory:'' nShowCmd:1.] .
>
> r = t fork.
>
> I wish to be able to kill the squeak.exe process being run from the shell.
>
> r terminate does not seem to do that.
>
> Any pointers to what I should use.
>
> Thanks in advance.
>
> Arushi
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Terminate a process in a Win32Shell

Arushi Aggarwal
On Wed, Apr 14, 2010 at 8:28 PM, Chris Muller <[hidden email]> wrote:
> Hi Arushi,
>
>> r = t fork.
>
> Even if you corrected this assignment, you would only have a Smalltalk
> "Process" object, which only terminates processes running in or above
> the interpreter; they have nothing to do with OS processes.
>
> To control OS processes, check out OSProcess

I am working on windows, and using OSProcess/Squeak Shell I was not
able to get it to execute an executable. Any pointers for that?
>
> As an alternative, you may wish to exit the other image gracefully.
>
That of course works, we were hoping we could force it to quit in case
of it getting hung.

Thanks.

>  - Chris
>
>
>
> On Tue, Apr 13, 2010 at 9:16 PM, Arushi Aggarwal <[hidden email]> wrote:
>> Hi all,
>>
>> I have one squeak image bring up another squeak image to run a script.
>> I have the following code in my workspace.
>>
>> shell1 := Win32Shell new.
>> t := [s := shell1 shellExecute:f lpOperation:'open'
>> lpFile:'Squeak.exe' lpParameters:'Squeak3.10.2-7179-basic.image
>> project-files/testNone.sh none' lpDirectory:'' nShowCmd:1.] .
>>
>> r = t fork.
>>
>> I wish to be able to kill the squeak.exe process being run from the shell.
>>
>> r terminate does not seem to do that.
>>
>> Any pointers to what I should use.
>>
>> Thanks in advance.
>>
>> Arushi
>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Terminate a process in a Win32Shell

David T. Lewis
On Thu, Apr 15, 2010 at 10:26:07AM -0500, Arushi Aggarwal wrote:

> On Wed, Apr 14, 2010 at 8:28 PM, Chris Muller <[hidden email]> wrote:
> > Hi Arushi,
> >
> >> r = t fork.
> >
> > Even if you corrected this assignment, you would only have a Smalltalk
> > "Process" object, which only terminates processes running in or above
> > the interpreter; they have nothing to do with OS processes.
> >
> > To control OS processes, check out OSProcess
>
> I am working on windows, and using OSProcess/Squeak Shell I was not
> able to get it to execute an executable. Any pointers for that?
> >

Information on OSProcess is here:
  http://wiki.squeak.org/squeak/708

I have not updated the page in a while, but the information on that
page is still valid.

The OSProcessPlugin for Windows is not distributed with the VM, so
you would need to build your own if you want to do this. With the
plugin in place, you can start external processes and terminate them
with #terminate as you would expect.

To build the plugin you need the OSProcessPlugin and VMMaker packages
from http://squeaksource.com.

Dave


Reply | Threaded
Open this post in threaded view
|

Re: Terminate a process in a Win32Shell

Arushi Aggarwal
On Thu, Apr 15, 2010 at 11:33 AM, David T. Lewis <[hidden email]> wrote:

> On Thu, Apr 15, 2010 at 10:26:07AM -0500, Arushi Aggarwal wrote:
>> On Wed, Apr 14, 2010 at 8:28 PM, Chris Muller <[hidden email]> wrote:
>> > Hi Arushi,
>> >
>> >> r = t fork.
>> >
>> > Even if you corrected this assignment, you would only have a Smalltalk
>> > "Process" object, which only terminates processes running in or above
>> > the interpreter; they have nothing to do with OS processes.
>> >
>> > To control OS processes, check out OSProcess
>>
>> I am working on windows, and using OSProcess/Squeak Shell I was not
>> able to get it to execute an executable. Any pointers for that?
>> >
>
> Information on OSProcess is here:
>  http://wiki.squeak.org/squeak/708
>
> I have not updated the page in a while, but the information on that
> page is still valid.
>
> The OSProcessPlugin for Windows is not distributed with the VM, so
> you would need to build your own if you want to do this. With the
> plugin in place, you can start external processes and terminate them
> with #terminate as you would expect.
>
> To build the plugin you need the OSProcessPlugin and VMMaker packages
> from http://squeaksource.com.

I got OSProcessPluginV4-3-7.sar and the VMMakerPackage. The VMMaker
does not  list OSProcessPlugin as an available Plugin.

How do I make it so/what file is it missing?
>
> Dave
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Terminate a process in a Win32Shell

David T. Lewis
On Thu, Apr 15, 2010 at 10:53:37PM -0500, Arushi Aggarwal wrote:

> On Thu, Apr 15, 2010 at 11:33 AM, David T. Lewis <[hidden email]> wrote:
> > On Thu, Apr 15, 2010 at 10:26:07AM -0500, Arushi Aggarwal wrote:
> >> On Wed, Apr 14, 2010 at 8:28 PM, Chris Muller <[hidden email]> wrote:
> >> > Hi Arushi,
> >> >
> >> >> r = t fork.
> >> >
> >> > Even if you corrected this assignment, you would only have a Smalltalk
> >> > "Process" object, which only terminates processes running in or above
> >> > the interpreter; they have nothing to do with OS processes.
> >> >
> >> > To control OS processes, check out OSProcess
> >>
> >> I am working on windows, and using OSProcess/Squeak Shell I was not
> >> able to get it to execute an executable. Any pointers for that?
> >> >
> >
> > Information on OSProcess is here:
> > ?http://wiki.squeak.org/squeak/708
> >
> > I have not updated the page in a while, but the information on that
> > page is still valid.
> >
> > The OSProcessPlugin for Windows is not distributed with the VM, so
> > you would need to build your own if you want to do this. With the
> > plugin in place, you can start external processes and terminate them
> > with #terminate as you would expect.
> >
> > To build the plugin you need the OSProcessPlugin and VMMaker packages
> > from http://squeaksource.com.
>
> I got OSProcessPluginV4-3-7.sar and the VMMakerPackage. The VMMaker
> does not  list OSProcessPlugin as an available Plugin.
>
> How do I make it so/what file is it missing?

OSProcessPlugin is a separate package from OSProcess itself. The home
page is http://wiki.squeak.org/squeak/3349. You can use the SAR file
from that page, but it is better to go to http:squeaksource.com and
get the latest version of the package in "OSProcessPlugin". Once you
have loaded this, you should be able to open a VMMaker window and find
Win32OSProcessPlugin as an available plugin.

Follow the normal instructions for building on Windows
(http://squeakvm.org/win32/compiling.html), with the following two notes:

1) OSProcessPlugin (OSPP) requires two header files:
    platforms\Cross\plugins\FilePlugin\FilePlugin.h
    platforms\Cross\plugins\SocketPlugin\FilePlugin.h
The normal Makefile probably will not find these, so you can either fix
your makefile to find them, or just copy them somewhere where they will
be included.

2) Some OSPP functions will not work (opening stdout, console, etc)
on Windows unless you make changes to the file handle registry in
platforms\win32\vm\sqWin32HandleTable.h.

Dave