On Jun 24, 2008 at 11:22 PM, Luis Lavena wrote:
So, at the end, the ServiceHost automatic stuff didn't do the trick,
which is a pain. I wrote that code to be more intelligent, but I think
Windows beat me, again :-P
Can you provide me your patch for ServiceFB library in google code?:
http://code.google.com/p/mmediasys-labs/
Sorry, I almost forgot about this.
I do not have a patch, really. I simpy commented out the call to
_process_name_dyn_psapi and always set RunAsService (instead of RunAsUnknown):
'# RunMode() provide a simple way to get (*you*) from where this process
was started
'# and do the corresponding action.
function ServiceController.RunMode() as ServiceRunMode
dim result as ServiceRunMode
dim currPID as DWORD
dim parent_pid as uinteger
dim parent_name as string
dim start_mode as string
_dprint("ServiceController.RunMode()")
'# get this process PID
currPID = GetCurrentProcessId()
_dprint("CurrentPID: " + str(currPID))
'# get the parent PID
parent_pid = _parent_pid(currPID)
_dprint("ParentPID: " + str(parent_pid))
'# now the the name
parent_name = _process_name(parent_pid)
'##if (parent_name = "<unknown>") then
'## parent_name = _process_name_dyn_psapi(parent_pid)
'##end if
_dprint("Parent Name: " + parent_name)
'# this process started as service?
'# that means his parent is services.exe
if (parent_name = "services.exe") then
result = RunAsService
else
'# ok, it didn't start as service, analyze command line then
start_mode = lcase(trim(command(1)))
if (start_mode = "manage") then
'# start ServiceController.Manage()
result = RunAsManager
elseif (start_mode = "console") then
'# start ServiceController.Console()
result = RunAsConsole
else
'# ok, the first paramenter in the commandline didn't work,
'# report back so we could send the banner!
'## (ing) Run service anyway:
'## result = RunAsUnknown
result = RunAsService
end if
end if
_dprint("ServiceController.RunMode() done")
return result
end function
Just create a new issue and attach / paste your patch, I'll really
appreciate get rid of this thing that, at the end, didn't provide
anything but just bring pain to us (sniff) :-P
I do not know if this solves more problems than it opens up. Calling
mongrel_service.exe with no command line parameters just does nothing with the
version I posted above - which is ok for me and works fine. I am not sure if
this is an acceptable solution for everybody else, though ...
Bye,
Ingmar
_______________________________________________
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users