New topic: 

Shell execute, don't wait until finnished

<http://forums.realsoftware.com/viewtopic.php?t=45925>

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        Akiland          Post subject: Shell execute, don't wait until 
finnishedPosted: Thu Nov 15, 2012 1:08 am                                 
Joined: Tue Jan 04, 2011 3:02 am
Posts: 1004
Location: Jönköping, Sweden                Good morning 
I'm struggling with a little shell problem and I need some help.

I've built a method to make my app send messages to my syslog server. It simply 
executes a Shell command calling Netcat.
But the thing is that my app gets really slow when it executes the Shell as it 
is waiting for Netcat to finnish.
Is there a way to prevent my app from waiting for Netcat to finnish executing?
This is what I've tried:
This first code works but makes my app wait for the command to finnish.
command = "nc -w" + str(w) + " -u " + syslogHost + " " + str(syslogPort) + " 
<<< " + chr(34) + "<" + str(facility*8+severity) + ">" + chr(34) + chr(34) + 
syslogApp + " " + DefineEncoding(message, Encodings.UTF8) + chr(34)
sh = New Shell
if sh.IsRunning then
  sh.Exexute(command)
else
  MsgBox "ERROR"
  Return
end if

This code does nothing what so ever.
command = "nc -w" + str(w) + " -u " + syslogHost + " " + str(syslogPort) + " 
<<< " + chr(34) + "<" + str(facility*8+severity) + ">" + chr(34) + chr(34) + 
syslogApp + " " + DefineEncoding(message, Encodings.UTF8) + chr(34)
sh = New Shell
sh.Mode = 2
if sh.IsRunning then
  sh.Write(command)
  sh.Write Chr(13)
else
  MsgBox "ERROR"
  Return
end if


I've also tried to use "nohup" and "&" in the command itself but that made no 
difference.
Any ideas guys?     
_________________
 http://www.linkedin.com/in/albinkiland
Dev. iMac 27" + 2x22" LG (2.8GHz Intel Core i7, 12GB RAM, 120GB SSD) OS X 10.8
REAL.Studio Web Edition 2011r3  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to