calling child_process.exec in Node as though it was executed in a specific folder

I'm using the following to execute a CLI command in nodeJS

var cp = require('child_process');
cp.exec('foocommand', callback);

However, the foocommand is executing in the current folder node is running from. How can I make it execute as though it is being invoked from a different folder?

Its in the docs:

var cp = require('child_process');
cp.exec('foocommand', { cwd: 'path/to/dir/' }, callback);

Not a total expert but if its a cli then you want to be able to use stdin witch is not available with process.exec. Maybe you want to see if there is a programable interface for the cli?