Skip to content
This repository was archived by the owner on Apr 3, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,26 @@ When you want the task finish without aborting set failOnFailures to true.
####execMaxBuffer
Type: `Integer` Default: `200*1024`

Configure the Node JS `maxBuffer` option passed to the
[`exec`](http://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback) function.
This can be useful if you need to run a large test suite which outputs lot of logs, otherwise you could encounter a
Configure the Node JS `maxBuffer` option passed to the
[`exec`](http://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback) function.
This can be useful if you need to run a large test suite which outputs lot of logs, otherwise you could encounter a
`Fatal error: stdout maxBuffer exceeded.` error. See issue [#29](https://github.com/SaschaGalley/grunt-phpunit/issues/29) for more informations about this.

####execCwd
Type: `String` Default: ``

Current working directory of the child process

####execEnv
Type: `Object` Default: `{}`

Object Environment key-value pairs

####execEncoding
Type: `String` Default: `utf8`

####execTimeout
Type: `Number` Default: 0

####execKillSignal
Type: `String` Default: `SIGTERM`
20 changes: 19 additions & 1 deletion tasks/lib/phpunit.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,25 @@ exports.init = function(grunt) {
*/
exports.run = function(command, callback, config) {

var term = exec(command, {maxBuffer: config.execMaxBuffer}, function(err, stdout, stderr) {
var cmdCommands = {
cwd : "",
env : {},
encoding : 'utf8',
timeout : 0,
maxBuffer: 200*1024,
killSignal : "SIGTERM"
};

Object.keys(cmdCommands).forEach(function(key) {
var configKey = "exec" + key.charAt(0).toUpperCase() + key.slice(1);
if (config[configKey]) {
cmdCommands[key] = config[configKey];
} else {
delete cmdCommands[key];
}
});

var term = exec(command, cmdCommands, function(err, stdout, stderr) {

if (stdout && !config.followOutput) {
grunt.log.write(stdout);
Expand Down