Domanda

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
È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top