2010-12-03 05:34:57 +01:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2011-05-20 02:18:15 +02:00
|
|
|
// Package exec runs external commands. It wraps os.StartProcess to make it
|
|
|
|
// easier to remap stdin and stdout, connect I/O with pipes, and do other
|
|
|
|
// adjustments.
|
2010-12-03 05:34:57 +01:00
|
|
|
package exec
|
|
|
|
|
|
|
|
import (
|
2011-09-16 17:47:21 +02:00
|
|
|
"bytes"
|
2011-12-03 03:17:34 +01:00
|
|
|
"errors"
|
2011-09-16 17:47:21 +02:00
|
|
|
"io"
|
2010-12-03 05:34:57 +01:00
|
|
|
"os"
|
2011-03-17 00:05:44 +01:00
|
|
|
"strconv"
|
2011-09-16 17:47:21 +02:00
|
|
|
"syscall"
|
2010-12-03 05:34:57 +01:00
|
|
|
)
|
|
|
|
|
2011-09-16 17:47:21 +02:00
|
|
|
// Error records the name of a binary that failed to be be executed
|
|
|
|
// and the reason it failed.
|
|
|
|
type Error struct {
|
2011-12-03 03:17:34 +01:00
|
|
|
Name string
|
|
|
|
Err error
|
2011-09-16 17:47:21 +02:00
|
|
|
}
|
2010-12-03 05:34:57 +01:00
|
|
|
|
2011-12-03 03:17:34 +01:00
|
|
|
func (e *Error) Error() string {
|
|
|
|
return "exec: " + strconv.Quote(e.Name) + ": " + e.Err.Error()
|
2011-09-16 17:47:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Cmd represents an external command being prepared or run.
|
2010-12-03 05:34:57 +01:00
|
|
|
type Cmd struct {
|
2011-09-16 17:47:21 +02:00
|
|
|
// Path is the path of the command to run.
|
|
|
|
//
|
|
|
|
// This is the only field that must be set to a non-zero
|
|
|
|
// value.
|
|
|
|
Path string
|
|
|
|
|
|
|
|
// Args holds command line arguments, including the command as Args[0].
|
|
|
|
// If the Args field is empty or nil, Run uses {Path}.
|
|
|
|
//
|
|
|
|
// In typical use, both Path and Args are set by calling Command.
|
|
|
|
Args []string
|
|
|
|
|
|
|
|
// Env specifies the environment of the process.
|
|
|
|
// If Env is nil, Run uses the current process's environment.
|
|
|
|
Env []string
|
|
|
|
|
|
|
|
// Dir specifies the working directory of the command.
|
|
|
|
// If Dir is the empty string, Run runs the command in the
|
|
|
|
// calling process's current directory.
|
|
|
|
Dir string
|
|
|
|
|
2011-12-13 00:40:51 +01:00
|
|
|
// Stdin specifies the process's standard input. If Stdin is
|
|
|
|
// nil, the process reads from the null device (os.DevNull).
|
2011-09-16 17:47:21 +02:00
|
|
|
Stdin io.Reader
|
|
|
|
|
|
|
|
// Stdout and Stderr specify the process's standard output and error.
|
|
|
|
//
|
2011-12-13 00:40:51 +01:00
|
|
|
// If either is nil, Run connects the corresponding file descriptor
|
|
|
|
// to the null device (os.DevNull).
|
2011-09-16 17:47:21 +02:00
|
|
|
//
|
|
|
|
// If Stdout and Stderr are are the same writer, at most one
|
|
|
|
// goroutine at a time will call Write.
|
|
|
|
Stdout io.Writer
|
|
|
|
Stderr io.Writer
|
|
|
|
|
2011-10-27 01:57:58 +02:00
|
|
|
// ExtraFiles specifies additional open files to be inherited by the
|
|
|
|
// new process. It does not include standard input, standard output, or
|
|
|
|
// standard error. If non-nil, entry i becomes file descriptor 3+i.
|
2012-01-13 06:11:45 +01:00
|
|
|
//
|
2012-03-02 17:38:43 +01:00
|
|
|
// BUG: on OS X 10.6, child processes may sometimes inherit unwanted fds.
|
2012-01-13 06:11:45 +01:00
|
|
|
// http://golang.org/issue/2603
|
2011-10-27 01:57:58 +02:00
|
|
|
ExtraFiles []*os.File
|
|
|
|
|
2011-09-16 17:47:21 +02:00
|
|
|
// SysProcAttr holds optional, operating system-specific attributes.
|
|
|
|
// Run passes it to os.StartProcess as the os.ProcAttr's Sys field.
|
|
|
|
SysProcAttr *syscall.SysProcAttr
|
|
|
|
|
|
|
|
// Process is the underlying process, once started.
|
2011-03-17 00:05:44 +01:00
|
|
|
Process *os.Process
|
2011-09-16 17:47:21 +02:00
|
|
|
|
2012-03-02 21:01:37 +01:00
|
|
|
// ProcessState contains information about an exited process,
|
2012-03-02 17:38:43 +01:00
|
|
|
// available after a call to Wait or Run.
|
2012-03-02 21:01:37 +01:00
|
|
|
ProcessState *os.ProcessState
|
2012-03-02 17:38:43 +01:00
|
|
|
|
2011-12-03 03:17:34 +01:00
|
|
|
err error // last error (from LookPath, stdin, stdout, stderr)
|
|
|
|
finished bool // when Wait was called
|
2011-09-16 17:47:21 +02:00
|
|
|
childFiles []*os.File
|
|
|
|
closeAfterStart []io.Closer
|
|
|
|
closeAfterWait []io.Closer
|
2011-12-03 03:17:34 +01:00
|
|
|
goroutine []func() error
|
|
|
|
errch chan error // one send per goroutine
|
2011-03-17 00:05:44 +01:00
|
|
|
}
|
|
|
|
|
2011-09-16 17:47:21 +02:00
|
|
|
// Command returns the Cmd struct to execute the named program with
|
|
|
|
// the given arguments.
|
|
|
|
//
|
|
|
|
// It sets Path and Args in the returned structure and zeroes the
|
|
|
|
// other fields.
|
|
|
|
//
|
|
|
|
// If name contains no path separators, Command uses LookPath to
|
|
|
|
// resolve the path to a complete name if possible. Otherwise it uses
|
|
|
|
// name directly.
|
|
|
|
//
|
|
|
|
// The returned Cmd's Args field is constructed from the command name
|
|
|
|
// followed by the elements of arg, so arg should not include the
|
|
|
|
// command name itself. For example, Command("echo", "hello")
|
|
|
|
func Command(name string, arg ...string) *Cmd {
|
|
|
|
aname, err := LookPath(name)
|
|
|
|
if err != nil {
|
|
|
|
aname = name
|
|
|
|
}
|
|
|
|
return &Cmd{
|
|
|
|
Path: aname,
|
|
|
|
Args: append([]string{name}, arg...),
|
|
|
|
err: err,
|
|
|
|
}
|
2011-03-17 00:05:44 +01:00
|
|
|
}
|
|
|
|
|
2011-09-16 17:47:21 +02:00
|
|
|
// interfaceEqual protects against panics from doing equality tests on
|
|
|
|
// two interfaces with non-comparable underlying types
|
|
|
|
func interfaceEqual(a, b interface{}) bool {
|
|
|
|
defer func() {
|
|
|
|
recover()
|
|
|
|
}()
|
|
|
|
return a == b
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
|
|
|
|
2011-09-16 17:47:21 +02:00
|
|
|
func (c *Cmd) envv() []string {
|
|
|
|
if c.Env != nil {
|
|
|
|
return c.Env
|
|
|
|
}
|
|
|
|
return os.Environ()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Cmd) argv() []string {
|
|
|
|
if len(c.Args) > 0 {
|
|
|
|
return c.Args
|
|
|
|
}
|
|
|
|
return []string{c.Path}
|
|
|
|
}
|
|
|
|
|
2011-12-03 03:17:34 +01:00
|
|
|
func (c *Cmd) stdin() (f *os.File, err error) {
|
2011-09-16 17:47:21 +02:00
|
|
|
if c.Stdin == nil {
|
|
|
|
f, err = os.Open(os.DevNull)
|
|
|
|
c.closeAfterStart = append(c.closeAfterStart, f)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if f, ok := c.Stdin.(*os.File); ok {
|
|
|
|
return f, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
pr, pw, err := os.Pipe()
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
c.closeAfterStart = append(c.closeAfterStart, pr)
|
|
|
|
c.closeAfterWait = append(c.closeAfterWait, pw)
|
2011-12-03 03:17:34 +01:00
|
|
|
c.goroutine = append(c.goroutine, func() error {
|
2011-09-16 17:47:21 +02:00
|
|
|
_, err := io.Copy(pw, c.Stdin)
|
|
|
|
if err1 := pw.Close(); err == nil {
|
|
|
|
err = err1
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
2011-09-16 17:47:21 +02:00
|
|
|
return err
|
|
|
|
})
|
|
|
|
return pr, nil
|
|
|
|
}
|
|
|
|
|
2011-12-03 03:17:34 +01:00
|
|
|
func (c *Cmd) stdout() (f *os.File, err error) {
|
2011-09-16 17:47:21 +02:00
|
|
|
return c.writerDescriptor(c.Stdout)
|
|
|
|
}
|
|
|
|
|
2011-12-03 03:17:34 +01:00
|
|
|
func (c *Cmd) stderr() (f *os.File, err error) {
|
2011-09-16 17:47:21 +02:00
|
|
|
if c.Stderr != nil && interfaceEqual(c.Stderr, c.Stdout) {
|
|
|
|
return c.childFiles[1], nil
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
2011-09-16 17:47:21 +02:00
|
|
|
return c.writerDescriptor(c.Stderr)
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
|
|
|
|
2011-12-03 03:17:34 +01:00
|
|
|
func (c *Cmd) writerDescriptor(w io.Writer) (f *os.File, err error) {
|
2011-09-16 17:47:21 +02:00
|
|
|
if w == nil {
|
|
|
|
f, err = os.OpenFile(os.DevNull, os.O_WRONLY, 0)
|
|
|
|
c.closeAfterStart = append(c.closeAfterStart, f)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if f, ok := w.(*os.File); ok {
|
|
|
|
return f, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
pr, pw, err := os.Pipe()
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
c.closeAfterStart = append(c.closeAfterStart, pw)
|
|
|
|
c.closeAfterWait = append(c.closeAfterWait, pr)
|
2011-12-03 03:17:34 +01:00
|
|
|
c.goroutine = append(c.goroutine, func() error {
|
2011-09-16 17:47:21 +02:00
|
|
|
_, err := io.Copy(w, pr)
|
|
|
|
return err
|
|
|
|
})
|
|
|
|
return pw, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Run starts the specified command and waits for it to complete.
|
2010-12-03 05:34:57 +01:00
|
|
|
//
|
2011-09-16 17:47:21 +02:00
|
|
|
// The returned error is nil if the command runs, has no problems
|
|
|
|
// copying stdin, stdout, and stderr, and exits with a zero exit
|
|
|
|
// status.
|
|
|
|
//
|
|
|
|
// If the command fails to run or doesn't complete successfully, the
|
2011-12-03 03:17:34 +01:00
|
|
|
// error is of type *ExitError. Other error types may be
|
2011-09-16 17:47:21 +02:00
|
|
|
// returned for I/O problems.
|
2011-12-03 03:17:34 +01:00
|
|
|
func (c *Cmd) Run() error {
|
2011-09-16 17:47:21 +02:00
|
|
|
if err := c.Start(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return c.Wait()
|
|
|
|
}
|
|
|
|
|
|
|
|
// Start starts the specified command but does not wait for it to complete.
|
2011-12-03 03:17:34 +01:00
|
|
|
func (c *Cmd) Start() error {
|
2011-09-16 17:47:21 +02:00
|
|
|
if c.err != nil {
|
|
|
|
return c.err
|
|
|
|
}
|
|
|
|
if c.Process != nil {
|
2011-12-03 03:17:34 +01:00
|
|
|
return errors.New("exec: already started")
|
2011-09-16 17:47:21 +02:00
|
|
|
}
|
|
|
|
|
2011-12-03 03:17:34 +01:00
|
|
|
type F func(*Cmd) (*os.File, error)
|
2011-09-16 17:47:21 +02:00
|
|
|
for _, setupFd := range []F{(*Cmd).stdin, (*Cmd).stdout, (*Cmd).stderr} {
|
|
|
|
fd, err := setupFd(c)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
c.childFiles = append(c.childFiles, fd)
|
|
|
|
}
|
2011-10-27 01:57:58 +02:00
|
|
|
c.childFiles = append(c.childFiles, c.ExtraFiles...)
|
2011-09-16 17:47:21 +02:00
|
|
|
|
2011-12-03 03:17:34 +01:00
|
|
|
var err error
|
2011-09-16 17:47:21 +02:00
|
|
|
c.Process, err = os.StartProcess(c.Path, c.argv(), &os.ProcAttr{
|
|
|
|
Dir: c.Dir,
|
|
|
|
Files: c.childFiles,
|
|
|
|
Env: c.envv(),
|
|
|
|
Sys: c.SysProcAttr,
|
|
|
|
})
|
2010-12-03 05:34:57 +01:00
|
|
|
if err != nil {
|
2011-09-16 17:47:21 +02:00
|
|
|
return err
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
2011-09-16 17:47:21 +02:00
|
|
|
|
|
|
|
for _, fd := range c.closeAfterStart {
|
|
|
|
fd.Close()
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
2011-09-16 17:47:21 +02:00
|
|
|
|
2011-12-03 03:17:34 +01:00
|
|
|
c.errch = make(chan error, len(c.goroutine))
|
2011-09-16 17:47:21 +02:00
|
|
|
for _, fn := range c.goroutine {
|
2011-12-03 03:17:34 +01:00
|
|
|
go func(fn func() error) {
|
2011-09-16 17:47:21 +02:00
|
|
|
c.errch <- fn()
|
|
|
|
}(fn)
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
2011-09-16 17:47:21 +02:00
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2011-12-03 03:17:34 +01:00
|
|
|
// An ExitError reports an unsuccessful exit by a command.
|
|
|
|
type ExitError struct {
|
2012-03-02 21:01:37 +01:00
|
|
|
*os.ProcessState
|
2011-12-03 03:17:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *ExitError) Error() string {
|
2012-03-02 21:01:37 +01:00
|
|
|
return e.ProcessState.String()
|
2011-12-03 03:17:34 +01:00
|
|
|
}
|
|
|
|
|
2011-09-16 17:47:21 +02:00
|
|
|
// Wait waits for the command to exit.
|
|
|
|
// It must have been started by Start.
|
|
|
|
//
|
|
|
|
// The returned error is nil if the command runs, has no problems
|
|
|
|
// copying stdin, stdout, and stderr, and exits with a zero exit
|
|
|
|
// status.
|
|
|
|
//
|
|
|
|
// If the command fails to run or doesn't complete successfully, the
|
2011-12-03 03:17:34 +01:00
|
|
|
// error is of type *ExitError. Other error types may be
|
2011-09-16 17:47:21 +02:00
|
|
|
// returned for I/O problems.
|
2011-12-03 03:17:34 +01:00
|
|
|
func (c *Cmd) Wait() error {
|
2011-09-16 17:47:21 +02:00
|
|
|
if c.Process == nil {
|
2011-12-03 03:17:34 +01:00
|
|
|
return errors.New("exec: not started")
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
2011-09-16 17:47:21 +02:00
|
|
|
if c.finished {
|
2011-12-03 03:17:34 +01:00
|
|
|
return errors.New("exec: Wait was already called")
|
2011-09-16 17:47:21 +02:00
|
|
|
}
|
|
|
|
c.finished = true
|
2012-03-02 21:01:37 +01:00
|
|
|
state, err := c.Process.Wait()
|
|
|
|
c.ProcessState = state
|
2010-12-03 05:34:57 +01:00
|
|
|
|
2011-12-03 03:17:34 +01:00
|
|
|
var copyError error
|
2011-09-16 17:47:21 +02:00
|
|
|
for _ = range c.goroutine {
|
|
|
|
if err := <-c.errch; err != nil && copyError == nil {
|
|
|
|
copyError = err
|
|
|
|
}
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
2011-09-16 17:47:21 +02:00
|
|
|
|
|
|
|
for _, fd := range c.closeAfterWait {
|
|
|
|
fd.Close()
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
2011-09-16 17:47:21 +02:00
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return err
|
2012-03-02 21:01:37 +01:00
|
|
|
} else if !state.Success() {
|
|
|
|
return &ExitError{state}
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
2011-09-16 17:47:21 +02:00
|
|
|
|
|
|
|
return copyError
|
|
|
|
}
|
|
|
|
|
|
|
|
// Output runs the command and returns its standard output.
|
2011-12-03 03:17:34 +01:00
|
|
|
func (c *Cmd) Output() ([]byte, error) {
|
2011-09-16 17:47:21 +02:00
|
|
|
if c.Stdout != nil {
|
2011-12-03 03:17:34 +01:00
|
|
|
return nil, errors.New("exec: Stdout already set")
|
2011-03-17 00:05:44 +01:00
|
|
|
}
|
2011-09-16 17:47:21 +02:00
|
|
|
var b bytes.Buffer
|
|
|
|
c.Stdout = &b
|
|
|
|
err := c.Run()
|
|
|
|
return b.Bytes(), err
|
|
|
|
}
|
|
|
|
|
|
|
|
// CombinedOutput runs the command and returns its combined standard
|
|
|
|
// output and standard error.
|
2011-12-03 03:17:34 +01:00
|
|
|
func (c *Cmd) CombinedOutput() ([]byte, error) {
|
2011-03-17 00:05:44 +01:00
|
|
|
if c.Stdout != nil {
|
2011-12-03 03:17:34 +01:00
|
|
|
return nil, errors.New("exec: Stdout already set")
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
2011-03-17 00:05:44 +01:00
|
|
|
if c.Stderr != nil {
|
2011-12-03 03:17:34 +01:00
|
|
|
return nil, errors.New("exec: Stderr already set")
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
2011-09-16 17:47:21 +02:00
|
|
|
var b bytes.Buffer
|
|
|
|
c.Stdout = &b
|
|
|
|
c.Stderr = &b
|
|
|
|
err := c.Run()
|
|
|
|
return b.Bytes(), err
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
|
|
|
|
2011-09-16 17:47:21 +02:00
|
|
|
// StdinPipe returns a pipe that will be connected to the command's
|
|
|
|
// standard input when the command starts.
|
2011-12-03 03:17:34 +01:00
|
|
|
func (c *Cmd) StdinPipe() (io.WriteCloser, error) {
|
2011-09-16 17:47:21 +02:00
|
|
|
if c.Stdin != nil {
|
2011-12-03 03:17:34 +01:00
|
|
|
return nil, errors.New("exec: Stdin already set")
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
2011-09-16 17:47:21 +02:00
|
|
|
if c.Process != nil {
|
2011-12-03 03:17:34 +01:00
|
|
|
return nil, errors.New("exec: StdinPipe after process started")
|
2011-09-16 17:47:21 +02:00
|
|
|
}
|
|
|
|
pr, pw, err := os.Pipe()
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
2011-09-16 17:47:21 +02:00
|
|
|
c.Stdin = pr
|
|
|
|
c.closeAfterStart = append(c.closeAfterStart, pr)
|
|
|
|
c.closeAfterWait = append(c.closeAfterWait, pw)
|
|
|
|
return pw, nil
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
|
|
|
|
2011-09-16 17:47:21 +02:00
|
|
|
// StdoutPipe returns a pipe that will be connected to the command's
|
|
|
|
// standard output when the command starts.
|
|
|
|
// The pipe will be closed automatically after Wait sees the command exit.
|
2011-12-03 03:17:34 +01:00
|
|
|
func (c *Cmd) StdoutPipe() (io.ReadCloser, error) {
|
2011-09-16 17:47:21 +02:00
|
|
|
if c.Stdout != nil {
|
2011-12-03 03:17:34 +01:00
|
|
|
return nil, errors.New("exec: Stdout already set")
|
2011-09-16 17:47:21 +02:00
|
|
|
}
|
2011-03-17 00:05:44 +01:00
|
|
|
if c.Process != nil {
|
2011-12-03 03:17:34 +01:00
|
|
|
return nil, errors.New("exec: StdoutPipe after process started")
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
2011-09-16 17:47:21 +02:00
|
|
|
pr, pw, err := os.Pipe()
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
c.Stdout = pw
|
|
|
|
c.closeAfterStart = append(c.closeAfterStart, pw)
|
|
|
|
c.closeAfterWait = append(c.closeAfterWait, pr)
|
|
|
|
return pr, nil
|
|
|
|
}
|
2010-12-03 05:34:57 +01:00
|
|
|
|
2011-09-16 17:47:21 +02:00
|
|
|
// StderrPipe returns a pipe that will be connected to the command's
|
|
|
|
// standard error when the command starts.
|
|
|
|
// The pipe will be closed automatically after Wait sees the command exit.
|
2011-12-03 03:17:34 +01:00
|
|
|
func (c *Cmd) StderrPipe() (io.ReadCloser, error) {
|
2011-09-16 17:47:21 +02:00
|
|
|
if c.Stderr != nil {
|
2011-12-03 03:17:34 +01:00
|
|
|
return nil, errors.New("exec: Stderr already set")
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
2011-09-16 17:47:21 +02:00
|
|
|
if c.Process != nil {
|
2011-12-03 03:17:34 +01:00
|
|
|
return nil, errors.New("exec: StderrPipe after process started")
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
2011-09-16 17:47:21 +02:00
|
|
|
pr, pw, err := os.Pipe()
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
2011-09-16 17:47:21 +02:00
|
|
|
c.Stderr = pw
|
|
|
|
c.closeAfterStart = append(c.closeAfterStart, pw)
|
|
|
|
c.closeAfterWait = append(c.closeAfterWait, pr)
|
|
|
|
return pr, nil
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|