[issue1971] Cannot provide an error message in external hooks

jan1972 bugs at mercurial.selenic.com
Tue Jan 5 17:30:39 UTC 2010


New submission from jan1972 <jan.vorwerk at gmail.com>:

When running an external hook, the file hook.py uses util.system(), which,
in turn, uses subprocess.call().
This loses track of anything printed by the hook as an error message and the
end user is left alone with an error code.

Shouldn't it use popen instead and redirect sys.stderr to ui.write() ??

This is the way SVN hooks works and its very valuable.

PS:
A workaround would be to use internal hooks in which a reference to the ui
is provided, but I don't want to go down that route for several reasons:
   1. To ease the install process, our Windows boxes use the standard
TortoiseHg installer and therefore don't use our Python version already
installed elsewhere
   2. Besides the function in the 'commands' module, there is no real API
(which is guaranteed to work in future releases... or to be deprecated slowly)

----------
messages: 11382
nosy: jan1972
priority: bug
status: unread
title: Cannot provide an error message in external hooks

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue1971>
____________________________________________________


More information about the Mercurial-devel mailing list