[Backgroundrb-devel] strange problem with system call

hemant gethemant at gmail.com
Mon Aug 21 01:24:47 EDT 2006


Hi,

I am using backgroundrb to create a automated system of typo blogs.So, users
can create new typo applications using web interface and all that jazz.

Now..its working perfectly except one minor glitch. Since latest version of
typo has a command called "typo", i simply use that command to install new
typo app.And it works.

def do_work(args)
    DIR = "/home/foobar/public_html"
    username = args
    blog_name = username + "_blog"
    # creation part works flawlessly so lets skip that.
    # there is a problem while stopping it.
    if (Dir.chdir(DIR)) == 0
          current_dir = `pwd`
          @logger.debug("Current directory is #{current_dir}")
          stop_command = "typo stop "+ blog_name
          debug_stuff =
`#{stop_command}`
#line no 33
          @logger.debug("### #{debug_stuff}")
    else
      @logger.debug("### Error changing directory")
    end
end

Now let me assure that, args has correct username, because starting of
blog,migrating from sqlite to mysql works perfectly using this worker
thread.The only glitch is, in line # 33, "typo stop " doesn't work.I have
tried system also.system returns true, so typo should be stopped.But when i
do "ps aux|grep foobar" , it isn't ,process is still there.

When i tried `command`. All i got in debug_stuff variable is a empty
string.However, when i try same stuff from irb, it works as expected and
typo stopped.Now..again let me assure that, the worker thread IS getting
CALLED.

I have tried various stuff.But since, I am simply not able to debug, where
the heck problem is, I am lost. I was told that, system or `command` both
wait for the command to finish execution to resume normal execution.But for
me it SEEMS that the call to "typo stop #{blog_name}" returns immediately.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20060821/84d21e30/attachment.html 


More information about the Backgroundrb-devel mailing list