Good morning Christian!

I am experimenting with the ShellMBS class as a replacement to the xojo shell 
I’m using now as I need to be able to set some environment variables which your 
class supports and theirs doesn’t. I’ve run into a couple of odd issues I hope 
you can shed some light on. This is a MacOS only app at the moment but I’m 
trying not to have to use NSTask as I’d like to be able to build for linux in 
the future.

This app starts many helper apps as “plugins” which then communicate through a 
socket to the main app. Very little communication is done through the stdin/out 
pipes but I still read them and log anything that comes up as that is where 
some basic errors show up while developing the helpers.

It would be helpful to have a note in the documentation that shellMBS uses the 
folderitem.nativePath property and not the shell path as the xojo shell does. 
This means it works fine up until you try to launch something that has an 
escaped space in the command line at which point it fails with an NSException 
that has no other information associated with it making it tricky to pin down 
;) Unescaped spaces or other characters seem to work fine in the path. Took me 
a while to figure out why it worked in one place but not in another ;) This is 
also true of arguments being passed. They can contain spaces but if you add 
slashes to them then it does not work. Additionally if parameters are passed 
with quotes around them as one sometimes does with the xojo shell those quotes 
are still there when it’s passed to the child process unlike with the xojo 
shell. None of those things are a problem but I just didn’t realize that going 
in ;)

My first issue is that I’m unable to read anything from stderr. If I see that 
the availableBytesError has some data in it during the DataAvailable event and 
attempt to read it while the shell process is still running it hangs the app 
completely and must be force quit. If I try to read it after the process as 
quit when the data available event fires prior to the completed event then I 
can at least call readError without it hanging, but none of the data is 
returned, the string is always empty even if availableBytesError claims there 
is some output there.

My second issue is a bit stranger ;) If the parent app crashes, or needs to be 
force quit, the shell processes that have sockets open never close them. The 
remote devices they are connected to never realize they have gone away and if 
they are listening sockets those are never released. Even hours later they are 
still not available. The processes themselves are not stuck running, or at 
least they don’t show up in the Activity Monitor. When using the regular Xojo 
shell class if the program crashes it can be restarted immediately and 
everything reconnects just as if the sockets were closed properly. Is there 
something different about how the system manages shutting down the shell 
processes with ShellMBS vs the xojo shell? I have to restart the entire machine 
before I can create another instance of them listening on a specific port and I 
definitely do not have to do that with the xojo shell. I’m not sure how to work 
around that. Of course the app shouldn’t crash ;) But thats not 100% possible 
to guarantee ;) The parent app is launched by launchd so it happily restarts 
where it left off when it happens, but using ShellMBS almost nothing works 
after it does so.


Thanks,
 James


James Sentman                       http://www.PlanetaryGear.org                
http://MacHomeAutomation.com





_______________________________________________
mbsplugins@monkeybreadsoftware.info mailing list
%(list_address)s
https://ml-cgn08.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Reply via email to