Subprocess: allow non-copyable callbacks
authorSven Over <over@fb.com>
Fri, 22 Apr 2016 18:00:39 +0000 (11:00 -0700)
committerFacebook Github Bot 6 <facebook-github-bot-6-bot@fb.com>
Fri, 22 Apr 2016 18:05:31 +0000 (11:05 -0700)
commit0a9f3bc08e0ddec926411db5958b83449ce27e75
tree316d8ced3c2f1c016834465d197fbb1f28e3ccc8
parent12244d01218f5ca032b61cd8f779a7fe91b40bf3
Subprocess: allow non-copyable callbacks

Summary:Instead of std::function<bool(int, int)>, use folly::Function to
pass callbacks to Subprocess::communicate. This makes it possible
to pass non-copyable callables, which is especially interesting
because Subprocess::readLinesCallback returns a non-copyable
object.

This diff also fixes the forwarding of the callback passed to
readLinesCallback in case you pass an lvalue reference.

Reviewed By: snarkmaster

Differential Revision: D3169956

fb-gh-sync-id: 7a906f9a3ab50502fc04e0d83a23ca5e0201bb3e
fbshipit-source-id: 7a906f9a3ab50502fc04e0d83a23ca5e0201bb3e
folly/Subprocess.h