grunt-exec doesn't recognize a custom function defined in bash

413 views Asked by At

Grunt version: CLI - v1.2.0
local - v1.0.1

I'm using grunt-exec to start a local DynamoDB server. I'm doing this by creating a custom function in .bashrc then calling it inside grunt-exec. I also tried explicitly creating an alias, which didn't fix it.

~/.bashrc

runDynamo () {
    java -Djava.library.path=~/DynamoDBServer/DynamoDBLocal_lib -jar ~/DynamoDBServer/DynamoDBLocal.jar -sharedDb
}

Gruntfile.js

// ...
exec: {
    dynamo: {
        // Run DynamoDB locally at port 8000
        // This alias has been set during the inital installation
        command: "runDynamo"
    }
}
// ...
var mode = grunt.option("mode") || "test";
grunt.registerTask("run", ["exec:" + mode]);

When I run grunt run --mode=dynamo, I get the following error in stdout:

Running "exec:dynamo" (exec) task
>> /bin/sh: 1: runDynamo: not found
>> Exited with code: 127.
>> Error executing child process: Error: Process exited with code 127.

The command works fine when used directly in bash (i.e. $ runDynamo), so I'm not sure why grunt-exec isn't working here.

0

There are 0 answers