0

i'm trying to upload some files to a svn repository with ruby. But after checking out, the rest of the code is not being executed.

r = SvnRepository.new("#{repDir}")
r.checkout("", ".", user, pass)

puts "NOT EXECUTING!"
`cp -r #{compFold} ./trunk/#{compFold}`
r.add("trunk", "./#{compFold}")
r.commit("trunk", "Component #{compFold} uploaded", user, pass)

r.checkout code:

def checkout(repository, working_copy_path, user = nil, pass = nil)
    #result = `cd #{working_copy_path} && #{@svn} co file:///#{@repository_base}/#{repository}`
    check = "cd #{working_copy_path} && #{@svn} co #{@repository_base}/#{repository}"
    if user != nil
        check = check + " --username #{user}"
        if pass != nil
            check = check + " --password #{pass}"
        end
    end

    result = exec(check)
    result[/d+/]
end
Zoe
  • 27,060
  • 21
  • 118
  • 148
user1573607
  • 522
  • 9
  • 23

1 Answers1

0

The call to exec inside checkout replaces the current process with one for the program being executed. Hence, exec never returns. See the docs for more detail.

You can replace exec with spawn to enable you to execute a process separate from your controlling process. Calling spawn will return the pid of the new process that you can then monitor using Process.

Rob Harrop
  • 3,445
  • 26
  • 26
  • What are you saying it's true. But i'm not trying to execute different threads. It works correctly changing **exec(check) for \`#{check}\`**. – user1573607 Oct 10 '12 at 10:47