5

I would like to know if there is a cross-platform (Windows, Linux, BSD) library with which I could start a process asynchronously and have iostream-like wrappers for its standard pipes.

I would like it to be able to be able to tell when the process has terminated.

Thank you.

1 Answers1

3

There are 2 libraries you can use:

QProcess

You can use QProcess class from Qt toolkit. More information can be found on this stackoverflow question and qt library.

libexecstream

This library is lighter than Qt, and is cross-platform

Others

  • pstreams release 0.17

    If you only want a console application you can use the old popen-based branch (release 0.17), which uses the Win32 functions _popen() and _pclose(), but these will not work in a GUI program (and might blow up your PC, if Windows doesn't do it for you.) This version doesn't have most of the library's features and is no longer maintained or tested.

Community
  • 1
  • 1
hamed
  • 597
  • 4
  • 15
  • Thank you for asuggestion, but since I don't already use Qt in my project, I would like something more lightweight. –  Jul 04 '12 at 12:09
  • did you use `system`? I think it's cross-platform. – hamed Jul 04 '12 at 12:14
  • Yes, I am currently using `system()`, but this is a blocking call and AFAIK does not enable input/output redirection. –  Jul 04 '12 at 12:15
  • Looks great but if I understand correctly, these are all POSIX-specific. I want it to work on Win32 (without Cygwin) as well. –  Jul 04 '12 at 12:25
  • pstreams FAQ notes that you can use [libexecstream](http://libexecstream.sourceforge.net/) which is cross-platform. – hamed Jul 04 '12 at 12:41
  • @Tibor Maybe you can [teach Windows Posix](http://stackoverflow.com/questions/4746043/where-does-microsoft-windows-7-posix-implementation-currently-stand). – nwp Jun 17 '15 at 21:27