help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Consistency of patch output


From: Bob Proulx
Subject: Re: Consistency of patch output
Date: Mon, 14 Sep 2009 13:06:38 -0600
User-agent: Mutt/1.5.18 (2008-05-17)

Jason Heeris wrote:
> I'm using patch from with a python script, and I was thinking of parsing
> the output to extract information about what was patched and what
> failed, so I can express it via my programs GUI.

I read this as you are running 'patch' as an external system command
and capturing the output and then parsing it to determine if patches
were successfully implemented or if not what was rejected?

> Is there a better way of interacting with it?

As far as I know that is the best way.  Actually running sub-programs
is very much the Unix philosophy.  Make use of code written by others
instead of writing it all again.

> Or a library? Text output is not strictly an API at all, let alone a
> stable one :P and I worry that the output of patch won't remain the

If you only use standard features you will improve your portability.

  http://www.opengroup.org/onlinepubs/009695399/utilities/patch.html

> way it is now, especially error messages. (I don't think that patch
> is translated by any major distro, so that's probably ignorable.)

For automated parsing you might be best served by forcing a standard
locale setting with 'LC_ALL=POSIX' (aka 'LC_ALL=C') when running the
program.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]