Code review comment for lp:~jspashett/bzr/587868_args_handling_cant_debug

Revision history for this message
Jason Spashett (jspashett) wrote :

Jason Spashett wrote:
> Martin [gz] wrote:
>
> ...
>> Just AssertionError would be fine here.
>>
>> I'd have no problem with this landing as-is though.
>>
>>
>
> If you want I can start up another branch try and do what you say Martin
> and if Alexander thinks it's a good idea.
>
I've just 'discovered' that the unit tests don't pass, and they don't
because of course sys.argv isn't set. And so an exception is raised, namely:
raise InternalBzrError("len(GetCommandLineW(...)) < len(sys.argv) should
not be possible")
It's all rather messy now somehow.

I suppose that could be transformed into a > if statement instead.

Is it possible to call near the start of execution the GetCommandLineW
function, process it for 'extraneous' args and then set sys.argv to the
result? would this work? I just say that because it may get around these
fiddly special cases that are now cropping up -- like the
--profile-imports fix. Instead, fix it up once and assign it to
sys.argv, and the rest of the code can carry on as it does removing args
or whatever it wants to do.

« Back to merge proposal