Page MenuHomePhabricator

[API] Have SBCommandReturnObject::GetOutput/Error return "" instead of nullptr

Authored by labath on Mon, Aug 5, 5:34 AM.



It seems this was an unintended side-effect of D26698. AFAICT, these
functions did return an empty string before that patch, and the patch
contained code which attempted to ensure that, but those efforts were
negated by ConstString::AsCString, which by default returns a nullptr
even for empty strings.

This patch:

  • fixes the GetOutput/Error methods to really return empty strings
  • adds and explicit test for that
  • removes a workaround in, which was masking this problem from our other tests

Diff Detail


Event Timeline

labath created this revision.Mon, Aug 5, 5:34 AM

Any thoughts on this one? The fix seems quite straight-forward, but I know there was a lot of discussion about None vs "" in the past (and I unfortunately don't remember the outcome of that, nor I was able to find those discussions), so I want to make sure I'm doing the right thing here...

clayborg accepted this revision.Tue, Aug 13, 9:51 AM
This revision is now accepted and ready to land.Tue, Aug 13, 9:51 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptWed, Aug 14, 1:13 AM