Happy !

hernan / ProcessWrapper

Project infos

License MIT
Tags wrapper, windows, api, win32
Creation date 2013-12-07
Website

Monticello registration

About ProcessWrapper

This is a fork from ProcessWrapper at SqueakSource and ported to Pharo >= 2.0

ProcessWrapper is a plugin + wrapper code for Win32 process execution with non-blocking stdin, stdout and stderr support. The project aims to give features similar to OSProcess, but it's not related to it in any other way. The platform code for the plugin is available under the MIT license

Installation

If you want to use stable package version (which automatically downloads the required .dll file) open the Catalog or Configuration Browser and load from there. Or execute the following script:

Metacello new
  smalltalkhubUser: 'hernan' project: 'ProcessWrapper';
  configuration: 'ProcessWrapper';
  version: #stable;
  load.

If you want to build the plugin yourself:

Gofer it
  url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main';
  package: 'ProcessWrapper-Core';
  package: 'ProcessWrapper-Plugin';
  package: 'ProcessWrapper-Tests';      
  load.

Example

ProcessWrapper new
  useStdout;
  startWithShellCommand: 'echo hello';
  upToEnd

Caveats:

  • #closeStdout, #closeStderr blocks the image in most cases (don't use them)
  • #exitCode kills the image if the process didn't terminate (use #isRunning and #waitForExitFor: before #exitCode)
  • After loading a new Monticello version the plugin is not updated (use ProcessWrapper >> #checkPlugin)
  • Accessing a ProcessWrapper instance which doesn't have a valid processPointer will crash the vm