[Mono-osx] Monitoring external processes
Andrew Coupe
Andrew at eVirtualStudio.com
Wed Oct 1 07:51:41 EDT 2008
Thanks for responding. I've tried using the Waitforexit but it makes no difference. The code below works fine on Mono 2.0 or .NET on Windows. It only fails on the Mac. The runtime error, which occurs when the Process.start method executes is:
mono(333,0xa000ed88) malloc: *** Deallocation of a pointer not malloced: 0x1a5898; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug
The error is easy to reproduce. Any Process.Start command generates the error. Once this error occurs Mono thinks the process has ended.
Thanks for any insight you have.
Regards
Andrew Coupe
andrew at eVirtualStudio.com
-----Original Message-----
From: pablosantosluac at terra.es [mailto:pablosantosluac at terra.es]
Sent: Wednesday, October 01, 2008 6:25 AM
To: Andrew Coupe
Cc: mono-osx at lists.ximian.com
Subject: Re: [Mono-osx] Monitoring external processes
You have a WaitForExit() method, don't you??
Andrew Coupe escribió:
>
> Hi all
>
>
>
> I need to detect when the user closes a process that my application
> launches. The following code works fine under .NET and Mono 2.0 on
> Windows but does not work on the Mac OS. On the mac, the process
> correctly starts the texeditor app. The problem is that HasExited
> incorrectly returns true immediately even though the window has not
> been closed.
>
>
>
> Dim Progname As String =
> Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
> + m_PATHDELIMITER + "Myfile.txt"
>
> Dim DAWproc As New Process()
>
> With DAWproc.StartInfo
>
> .FileName = Progname
>
> .Verb = "Open"
>
> .CreateNoWindow = True
>
> End With
>
> DAWproc.Start()
>
> While Not DAWproc.HasExited
>
> End While
>
> MessageBox.Show("App Closed")
>
>
>
> I’ve already tried using GetProcessbyname but, according to other
> threads on this forum, it appears that this function is not
> functioning correctly under Mono either. Can anyone suggest how I can
> accomplish this seemingly simple task in a reliable way that works on
> both Mac and Windows?
>
>
>
> Thanks in advance.
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Mono-osx mailing list
> Mono-osx at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-osx
>
More information about the Mono-osx
mailing list