+sub string_feed {
+ stream_to_string(PublicInbox::Feed::generate($_[0]));
+}
+
+# ensure we are compatible with existing ssoma installations which
+# do not use fast-import. We can probably remove this in 2018
+my %SSOMA;
+sub rand_use ($) {
+ return 0 if $ENV{FAST};
+ eval { require IPC::Run };
+ return 0 if $@;
+ my $cmd = $_[0];
+ my $x = $SSOMA{$cmd};
+ unless ($x) {
+ $x = -1;
+ foreach my $p (split(':', $ENV{PATH})) {
+ -x "$p/$cmd" or next;
+ $x = 1;
+ last;
+ }
+ $SSOMA{$cmd} = $x;
+ }
+ return if $x < 0;
+ ($x > 0 && (int(rand(10)) % 2) == 1);
+}
+
+my $tmpdir = tempdir('pi-feed-XXXXXX', TMPDIR => 1, CLEANUP => 1);