#358 Allow _run_command to capture and return output to stdout or stderr
Merged by cqi. Opened by cqi.
cqi/rpkg enhance-_run_command  into  master

Download 358.patch

Once process executes successfully, _run_command will return a tuple
consisting of three elements of process exit code and output to stdout
and stderr, which could be None if it does not intent to capture and
return them.

Original behavior is still available. As long as error is
raised from subprocess or process exits non-zero and stderr output is
not captured, rpkgError will be raised.

Several examples:

  1. run rpmbuild to build SRPM and output to stdout and stderr are not
    captured.

    _run_command(['rpmbuild', '-bs', 'pkg.spec'])

  2. run rpm to get package metadata from SPEC.

    _run_command( ['rpm', '-q', '--qf', '%{name}', '--specfile', 'pkg.spec'], return_stdout=True, return_text=True)

  3. run rpm but error is raised.

    _run_command(['rpm', '-q', '-qf', '--specfile', 'pkg.spec'])

Signed-off-by: Chenxiong Qi cqi@redhat.com

rebased onto a4a8b1b79446d52483a61327914f29a1f58185ce

Well, I did't find any problems.

rebased onto 9430063ba76246d4493c41933a5dea3902eece82

Rebased. Merging.

Pull-Request has been merged by cqi

Metadata