[Buildbot-devel] ShellCommand is failing when running with certain parameter

Maria Marcano mariangemarcano at gmail.com
Thu Aug 22 12:52:43 UTC 2013


The issue is because on Windows the commands runs in a temp batch file on
the slave see

https://github.com/buildbot/buildbot/blob/master/slave/buildslave/runprocess.py#L545so
we need to escape % on windows

but I'm not sure how to fix this on the slave side because how could we
distinguish from running

something like echo %username%  (were we don't need to escape %) or a
command like  git log --format=%H -1 -- (where we need to escape)


my temp local fix is to do a check like the following when running the
build step


    def escapeParameter(self, param):

        if isinstance(self.buildslave.slave_environ, dict) and 'OS' in
self.buildslave.slave_environ.keys() and 'windows' in
self.buildslave.slave_environ['OS'].lower():

            param = param.replace('%', '%%')

        return param

Greetings,

*Maria Marcano*
-------------------------------------------------
*Software Developer  *
*Find me on*
*linkedin <http://www.linkedin.com/in/mariangemarcano> |
blogger<http://mariangemarcano.blogspot.com/>
 | twitter <http://twitter.com/mariangemarcano/>*


On Thu, Aug 22, 2013 at 9:58 AM, Maria Marcano <mariangemarcano at gmail.com>wrote:

> Amber, thanks but I'm also running other commands that passes a "%"
> parameter
>
> Greetings,
>
> *Maria Marcano*
> -------------------------------------------------
> *Software Developer  *
> *Find me on*
> *linkedin <http://www.linkedin.com/in/mariangemarcano> | blogger<http://mariangemarcano.blogspot.com/>
>  | twitter <http://twitter.com/mariangemarcano/>*
>
>
> On Wed, Aug 21, 2013 at 8:13 PM, Amber Yust <amber.yust at gmail.com> wrote:
>
>> Well, I can't fix your format string issue, but I can give you a
>> workaround...
>>
>> git rev-parse HEAD
>>
>> ...is equivalent to...
>>
>> git log --format="%H" -1
>>
>>
>> On Wed, Aug 21, 2013 at 6:16 AM, Olof Johansson <olof.johansson at axis.com>wrote:
>>
>>> On 13-08-21 15:12 +0200, Maria Marcano wrote:
>>> > Olof, I've tried %%, which makes it work on windows but fails
>>> > on mac, I'm looking for a way to fix the problem in all
>>> > platforms :-)
>>>
>>> Yeah, I was about to add that this would make it work on Windows
>>> and only Windows. Sorry about that :-(. Having it work on both
>>> platforms is probably a little bit more tricky I reckon.
>>>
>>> --
>>> olofjn
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Introducing Performance Central, a new site from SourceForge and
>>> AppDynamics. Performance Central is your source for news, insights,
>>> analysis and resources for efficient Application Performance Management.
>>> Visit us today!
>>>
>>> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
>>> _______________________________________________
>>> Buildbot-devel mailing list
>>> Buildbot-devel at lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/buildbot-devel
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20130822/edfa18c3/attachment.html>


More information about the devel mailing list