GithubHelp home page GithubHelp logo

grunt-shell's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grunt-shell's Issues

Error running script: Object #<Socket> has no method 'clearLine'

I'm using grunt-shell to run the resume export script that is part of the jsonresume project (specifically the resume-cli and I get the following error:

/usr/local/lib/node_modules/resume-cli/node_modules/cli-spinner/index.js:16
    process.stdout.clearLine();
                   ^
TypeError: Object #<Socket> has no method 'clearLine'
    at null.<anonymous> (/usr/local/lib/node_modules/resume-cli/node_modules/cli-spinner/index.js:16:20)
    at wrapper [as _onTimeout] (timers.js:252:14)
    at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

It works fine when run straight from the command line though.

import database to remote server

Good morning, I would like to import a database inside a remote server.
I have tried this

shell: {
                install_db: {
                    options: {
                        stdout: true,
                        stderr: true
                    },
                    command: [
                        "ssh [email protected] mysql < /Volumes/www/database/mydb.sql --database db_test -u root -p password",
                    ].join("&&")
                }
            }

Return me this error:

 Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Logically user root has all priviligies.

I have also tried:

"ssh [email protected] mysql < /Volumes/www/database/mydb.sql --database db_test -u root -p",

and

"ssh [email protected]",
    "sudo mysql < /Volumes/www/database/mydb.sql --database db_test -u root -p password",

Not works.

Have you ever tried to create a task like that?

Thanks

stdin should allow an option to hide password chars

I have a grunt task where the command is an external app which asks for a password stdin. If i run the external app on the command line, this app hides the password chars.

But if i run it from grunt-shell, the password chars show in plain text. Is there a way to hide the respect the external app's stdin policy?

        shell: {
            deployToDev: {
                command: "deploy xxx.com",
                options: { stdout: true, stderr: true, failOnError: true }
            },

1.0.0 - no method setRawMode

Running a grunt shell task inside a grunt-concurrent task

Running "concurrent:build" (concurrent) task
    Warning: Running "concurrent:startJs" (concurrent) task
        Warning: Running "shell:hulk" (shell) task
        Warning: Object #<Socket> has no method 'setRawMode' Use --force to continue.

New format proposal

Hey Sindre! I have a similar shell task I've been working on. I started on it because I wanted chains of conditional commands. I was curious if something like this would be within the scope of this project and you wouldn't mind a PR for it. Here is an example:

grunt.initConfig({
  cmd: {
    deploy: [
    {
      'git symbolic-ref --short -q HEAD': function(result, good) {
        if (result.stdout !== 'deploy') {
          grunt.fatal('Can only deploy from the "deploy" branch.');
          return good(false);
        }
        good();
      },
    },
    // strings will just run the commands
    'grunt build',
    {
      // groups of commands will run concurrently
      'grunt checklist:one': function(result, good) {
        if (result.code !== 0) good(false);
        else good();
      },
      // shorthand will fail unless code === 0
      'grunt checklist:two': 0,
      // shorthand will fail unless result === 'good'
      'grunt checklist:three': 'good',
    },
    'grunt deploy',
    ],
  },
});

I understand this is a significant departure from the current config format of this task. So feel free to just tell me to get lost. :)

Thanks!

Be verbose when run with --verbose

When running grunt using grunt --verbose spit out some more information -- e.g. the full command line as it would appear after template string replacement.

Set Shell Environment

Is there a way to use the current shell's environment for the commands? I am using "git-bash" to run grunt but the grunt-shell commands run on "cmd".

Question about exec options parameterization

Hello,

This is a great plugin, it works really well and made it easy to transition from our shell scripts. I am wondering though, how I would go about parameterizing the cwd for a number of shell commands, where the current working directory is the only difference between the commands. See below, I feel like this should probably just be 1 entry with a changed cwd each time. I realize I could build up the hash structure with a function, but it seems like there should be a way to do this. I know that you can pass args to the command function, but I'm not sure if that can change the execOptions.

Thanks!
Steve

            compileGSettings: {
                options: {
                    stdout: true,
                    stderr: true,
                    execOptions: {
                        cwd: "node_modules/gsettingsBridge/nodegsettings"
                    }
                },
                command: function() {
                    return "node-gyp configure build";
                }
            },
            compileAlsaBridge: {
                options: {
                    stdout: true,
                    stderr: true,
                    execOptions: {
                        cwd: "node_modules/alsa/nodealsa"
                    }
                },
                command: function() {
                    return "node-gyp configure build";
                }
            },
            compileXrandrBridge: {
                options: {
                    stdout: true,
                    stderr: true,
                    execOptions: {
                        cwd: "node_modules/xrandr/nodexrandr"
                    }
                },
                command: function() {
                    return "node-gyp configure build";
                }
            }
        grunt.task.run("shell:compileGSettings");
        grunt.task.run("shell:compileAlsaBridge");
        grunt.task.run("shell:compileXrandrBridge");

i was unexpected at this time

While I was ready to Compile .po files into binary *.mo files with msgfmt in Windows 8.1. I got this error.
--> i was unexpected at this time.
@sindresorhus while running "for i in *.po; do msgfmt $i -o ${i%%.
}.mo; done" in git bash it completely runs without error.

Implemented Code:

shell: {
    options: {
        stdout: true,
        stderr: true
    },
    generatemos: {
        command: [
            'cd i18n/languages',
            'for i in *.po; do msgfmt $i -o ${i%%.*}.mo; done'
        ].join( '&&' )
    }
}

Please see: https://github.com/woothemes/woocommerce/blob/master/Gruntfile.js#L116 but is WooCommerce doing it without errors.

Please Help....

Please use child_process.spawn()

It can preserve stdout/stderr colors with stdio:

var child = child_process.spawn(app, [command], {cwd:cwd, stdio:"inherit"});

child.on("exit", function(code)
{
    this.removeAllListeners();

    callback();
});

Running shell commands sequentially.

Thanks for developing this great plugin.
I went through the documentation and did exactly that. But i get
Warning: Task "shell:multiple" failed. Use --force to continue

Aborted due to warnings."

How to provide options in Gruntfile.js to run these commands sequentially?

  1. bower install
  2. cp bower_components/** public/
  3. rm -r bower_components

Currently i am trying to achieve it by writing configurations like this:
grunt.initConfig({
shell:{
command:{
options: {stdout:true},
command: ['bower install',
'cp -r bower_components/** public/',
'rm -rf bower_components'
].join('&&')
}
}
);

So is there any additional 'flag' or settings to specify commands to run sequentially one after another?

Thanks.

Error: stderr maxBuffer exceeded

I use the following script:

#!/bin/bash

# A modified version of https://gist.github.com/sidwood/fcee60dc7b7e704d818d

set -e

PROTRACTOR_PATH="./node_modules/protractor"
DOWNLOAD_PATH="$PROTRACTOR_PATH/selenium"

CD_VERSION=2.10
CD_URL="http://chromedriver.storage.googleapis.com/$CD_VERSION"
CD_FILE=chromedriver_mac32.zip

SWD_VERSION=2.42
SWD_PATCH=2
SWD_URL="http://selenium-release.storage.googleapis.com/$SWD_VERSION"
SWD_FILE="selenium-server-standalone-$SWD_VERSION.$SWD_PATCH.jar"

# Exit with a given message
abort() {
  printf "\n  \033[31mError: $@\033[0m\n\n" && exit 1
}

# Ensure Protractor is installed
if [ ! -d "$(pwd)/$PROTRACTOR_PATH" ]; then abort "$PROTRACTOR_PATH not found"; fi

# Ensure dependencies are installed
command -v curl > /dev/null 2>&1 || abort "curl is required"
command -v unzip > /dev/null 2>&1 || abort "unzip is required"
command -v java > /dev/null 2>&1 || abort "java is required"


# Install Selenium and chromedriver

mkdir -p "$DOWNLOAD_PATH"
if [ ! -f "${DOWNLOAD_PATH}/chromedriver" ]; then
    cd "$DOWNLOAD_PATH"
    echo "  Downloading chromedriver archive..."
    curl -O --progress-bar "$CD_URL/$CD_FILE"
    unzip "$CD_FILE"
    rm "$CD_FILE"
    cd - >/dev/null
else
    echo "  Chromedriver found"
fi

if [ ! -f "${DOWNLOAD_PATH}/${SWD_FILE}" ]; then
    cd "$DOWNLOAD_PATH"
    echo "  Downloading selenium server..."
    curl -O --progress-bar "$SWD_URL/$SWD_FILE"
    cd - >/dev/null
else
    echo "  Selenium server found"
fi

echo "done!"

When I run it manually via ./bin/webdriver-update, it runs just fine:

$ ./bin/webdriver-update
  Downloading chromedriver archive...
######################################################################## 100.0%
Archive:  chromedriver_mac32.zip
  inflating: chromedriver            
  Downloading selenium server...
######################################################################## 100.0%
done!

but when run via grunt-shell (both 0.7.0 & 1.0.1) I get this:

Running "shell:webdriverUpdate" (shell) task
  Downloading chromedriver archive...
######################################################################## 100.0%
Archive:  chromedriver_mac32.zip
  inflating: chromedriver            
  Downloading selenium server...
                                                                           0.4%Warning: stderr maxBuffer exceeded. Use --force to continue.
Error: stderr maxBuffer exceeded.
    at Socket.<anonymous> (child_process.js:697:13)
    at Socket.emit (events.js:117:20)
    at Socket.<anonymous> (_stream_readable.js:764:14)
    at Socket.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:426:10)
    at emitReadable (_stream_readable.js:422:5)
    at readableAddChunk (_stream_readable.js:165:9)
    at Socket.Readable.push (_stream_readable.js:127:10)
    at Pipe.onread (net.js:528:21)

Aborted due to warnings.

Node 0.10.31, Grunt 0.4.5. grunt-shell config:

shell: {
    bundleInstall: {
        command: 'bundle install',
    },

    webdriverUpdate: {
        command: './bin/webdriver-update',
    },

    removeJenkinsReports: {
        command: 'rm -f test-results{,.*}.xml',
    },
},

Use grunt variable within STDIN

Hi,

I would like to run this command:
wp core config --dbname=<%= wp.config.db.name %> --dbuser=<%= wp.config.db.user %> --dbpass=<%= wp.config.db.password %> --extra-php <<< "define(\'WP_CONTENT_DIR\', dirname(__FILE__) . \'/../wp-content\');\n define(\'WP_CONTENT_URL\', \'<%= project.url =>\');"

The top three will work. Grunt will convert the variable <%= wp.config.db.name %> to the value of the options. But when I'm in STDIN (because of --extra-php), then Grunt won't convert the value, but just echoes <%= project.url =>

How can I get grunt to echo the value of the variable?

Thanks!

Version 0.6.3 interferes with other tasks

This is kind of weird. I use grunt-shell for one simple command executed near the beginning of the task chain; it works fine up to 0.6.2 & breaks in a weird name with 0.6.3:

$ grunt jenkins
Running "clean:main" (clean) task

Running "clean:app" (clean) task

Running "clean:dist" (clean) task

Running "clean:distTmp" (clean) task

Running "clean:api" (clean) task

Running "clean:test" (clean) task

Running "clean:coverage" (clean) task

Running "ddescribe-iit:files" (ddescribe-iit) task

Running "merge-conflict:files" (merge-conflict) task

Running "jshint:all" (jshint) task
>> 157 files lint free.

Running "jsonlint:all" (jsonlint) task
>> 62 files lint free.

Running "checkDependencies:this" (checkDependencies) task

Running "shell:bundleInstall" (shell) task
Using chunky_png (1.2.9)
Using multi_json (1.8.2)
Using rb-fsevent (0.9.3)
Using ffi (1.9.3)
Using rb-inotify (0.9.2)
Using rb-kqueue (0.2.0)
Using listen (1.1.6)
Using sass (3.3.0.rc.2)
Using compass-core (1.0.0.alpha.16)
Using compass-import-once (1.0.1)
Using json (1.8.1)
Using compass (1.0.0.alpha.17)
Using oily_png (1.1.0)
Using bundler (1.5.2)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

Running "clean:main" (clean) task

Running "clean:app" (clean) task

Running "clean:dist" (clean) task

Running "clean:distTmp" (clean) task

Running "clean:api" (clean) task

Running "clean:test" (clean) task

Running "clean:coverage" (clean) task

Running "includeScripts:app" (includeScripts) task
>> File app/index-template.html transformed to app/index.html.

Running "useDefsScripts:app" (useDefsScripts) task
>> File app/index.html transformed to app/index.html.

Running "sassDefinePath:app" (sassDefinePath) task

Running "preSass:app" (preSass) task

Running "compass:app" (compass) task

Running "postSass:app" (postSass) task

Running "autoprefixer:app" (autoprefixer) task

Running "defs:all" (defs) task
>> 103 files successfully generated.

Running "copy:app" (copy) task
Copied 49 files

Running "ngtemplates:test" (ngtemplates) task
File test/templates.js created.

Running "karma:jenkins" (karma) task
INFO [karma]: Karma v0.10.9 server started at http://localhost:8080/
INFO [launcher]: Starting browser Chrome
INFO [launcher]: Starting browser Firefox
Compass can't find any Sass files to compile.
Is your compass configuration correct?.
If you're trying to start a new project, you have left off the directory argument.
Run "compass -h" to get help.
Warning: ↑ Use --force to continue.

Aborted due to warnings.

`grunt-shell configuration is as follows:

shell: {
    options: {
        failOnError: true,
        stdout: true,
        stderr: true,
    },
    bundleInstall: {
        command: 'bundle install',
    },
},

and it's invoked via sth like:

grunt.registerTask('jenkins', [
    'shell:bundleInstall',
    /* other tasks */,
    'jenkins',
    /* other tasks */,
]);

If I either use grunt-shell 0.6.0-0.6.2 or I uncomment the 'shell:bundleInstall' line, everything works fine. With 0.6.3 it breaks with the pasted message.

My devDependencies:

{
    "connect-modrewrite": "0.5.11",
    "findup-sync": "0.1.2",
    "grunt": "0.4.2",
    "grunt-angular-templates": "0.5.1",
    "grunt-autoprefixer": "0.6.4",
    "grunt-check-dependencies": "0.3.0",
    "grunt-contrib-clean": "0.5.0",
    "grunt-contrib-compass": "0.7.0",
    "grunt-contrib-concat": "0.3.0",
    "grunt-contrib-connect": "0.6.0",
    "grunt-contrib-copy": "0.5.0",
    "grunt-contrib-htmlmin": "0.1.3",
    "grunt-contrib-jshint": "0.7.2",
    "grunt-contrib-uglify": "0.3.0",
    "grunt-contrib-watch": "0.5.3",
    "grunt-csso": "0.5.3",
    "grunt-ddescribe-iit": "0.0.4",
    "grunt-defs": "0.6.1",
    "grunt-jsonlint": "1.0.4",
    "grunt-karma": "0.6.2",
    "grunt-merge-conflict": "0.0.2",
    "grunt-newer": "0.6.1",
    "grunt-ng-annotate": "0.0.4",
    "grunt-notify": "0.2.17",
    "grunt-rev": "0.1.0",
    "grunt-shell": "0.6.3",
    "grunt-usemin": "2.0.2",
    "karma": "0.10.9",
    "karma-chrome-launcher": "0.1.2",
    "karma-coverage": "0.1.4",
    "karma-firefox-launcher": "0.1.3",
    "karma-jasmine": "0.1.5",
    "karma-junit-reporter": "0.2.1",
    "karma-ng-json2js-preprocessor": "0.0.5",
    "karma-opera-launcher": "0.1.0",
    "load-grunt-tasks": "0.2.1"
}

stdout doesn't work

I haven't debugged it thoroughly, but it's broken.

The command I used was phonegap build ios.

{
    exec: {
      'phonegap-build-ios' : {
        command    : 'phonegap build ios',
        stdout     : true,
        stderr     : true,
        failOnError: true
      }
    },
    // ...
}

No output was displayed regardless of stdout or stderr settings. What is see is:

$ grunt shell:phonegap-build-ios
Running "shell:phonegap-build-ios" (shell) task



Done, without errors.

You can get phonegap through NPM to test it out.

With the same settings, I've swapped grunt-shell with grunt-exec, and I started seeing the output.... so it's specific to grunt-shell.

Cheers.

How to use sudo with grunt-shell

I want to make sudo via ssh to my server like the follows:

ssh hostname 'sudo <command>'

But I can't because I need ti provide su password. How can I do it?

Grunt 0.4 Release

I'm posting this issue to let you know that we will be publishing Grunt 0.4 on Monday, February 18th.

If your plugin is not already Grunt 0.4 compatible, would you please consider updating it? For an overview of what's changed, please see our migration guide.

If you'd like to develop against the final version of Grunt before Monday, please specify "grunt": "0.4.0rc8" as a devDependency in your project. After Monday's release, you'll be able to use "grunt": "~0.4.0" to actually publish your plugin. If you depend on any plugins from the grunt-contrib series, please see our list of release candidates for compatible versions. All of these will be updated to final status when Grunt 0.4 is published.

Also, in an effort to reduce duplication of effort and fragmentation in the developer community, could you review the grunt-contrib series of plugins to see if any of your functionality overlaps significantly with them? Grunt-contrib is community maintained with 40+ contributors—we'd love to discuss any additions you'd like to make.

Finally, we're working on a new task format that doesn't depend on Grunt: it's called node-task. Once this is complete, there will be one more conversion, and then we'll never ask you to upgrade your plugins to support our changes again. Until that happens, thanks for bearing with us!

If you have any questions about how to proceed, please respond here, or join us in #grunt on irc.freenode.net.

Thanks, we really appreciate your work!

Bug: Missing commands not reported

Currently any command can be run and it will not raise any flags (even if it doesn't exist) by default.

If a command is being setup but it doesn't exist it should print some output explaining which command is undefined and stop the execution of the script.

I have looked at the options and I believe this issue is different than showing stderr or stdout.

This behaviour lets the user run any arbitrary command without checking whether the command exists or not. I don't think this is helpful.

Some commands fail

Try this:

// …
'command': '[ ! -f data.json ] && python generate-test-data.py'
// …

(In other words, only run the Python script if data.json doesn’t already exist.)

This throws the following error (--stack --verbose):

Running "shell:generate-test-data" (shell) task
Verifying property shell.generate-test-data exists in config...OK
File: [no files]
Warning: Command failed:  Use --force to continue.
Error: Command failed:
    at ChildProcess.exithandler (child_process.js:637:15)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Socket.<anonymous> (child_process.js:948:11)
    at Socket.EventEmitter.emit (events.js:117:20)
    at Pipe.close (net.js:465:12)

Aborted due to warnings.

On the other hand, this works fine:

// …
'command': 'if [ ! -f data.json ]; then python generate-test-data.py; fi'
// …

Both commands work fine in Bash.

missing stdout


    shell: {
      jar: {
        options: {
          stdout: true,
          sterr: true,
          execOptions: {
            cwd: 'apk-packer'
          }
        },
        command: 'java -jar tools\\apktool.jar b -f 9gameclient-debug 9gameclient-test.apk'
        // command: [
        //   'java -jar tools\\apktool.jar b -f 9gameclient-debug 9gameclient-test.apk',
        //   'ls','java -version'
        //   //'jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore test.keystore -storepass 123456 9gameclient-test.apk test'
        // ].join('&&')
      }

when run at cmd, output

D:\Desktop\clientapp-1.2.3\apk-packer>java -jar tools/apktool.jar b -f 9gameclient-debug 9gameclient-test.apk
I: Copying classes.dex file...
I: Copying raw resources...
I: Copying libs...
I: Building apk file...

but using grunt-shell output nth:

D:\Desktop\clientapp-1.2.3>grunt shell:jar
Running "shell:jar" (shell) task

Done, without errors.

even using java -x output Done, without errors. but expect Unrecognized option: -x Could not create the Java virtual machine.

did I missing any config?

async executing / don't wait for command to finish

Hi there,

Just wanted to let you know I forked your project (here grunt-shell-spawn) to add support for launching a command asynchronously.

Ideally I wanted to just add an async: true property but got too lazy into parsing the arguments as required for child-process.spawn. Plus there are a few minor differences on how they are handled, so I just created the new task spawn.

Do you think this would be an interesting feature to add to grunt-shell?

Output 'command' that is spawn

I am heavily using grunt-shell and I have this under my belt

        if ( _.isFunction( data.callback ) ) {
            data.callback.call( this );
            return;
        }
        //   Output the command line
        if ( _.isFunction( dataOut ) ) {
            dataOut( "\u001b[33m" + data.command + '\u001b[0m');
          } else if ( dataOut === true ) {
            log.write( "\u001b[33m" + data.command + '\u001b[0m');
        }

        exec( data.command, data.execOptions, function( err, stdout, stderr ) {

Can it get into it ? Sorry no time for PR!

Pipe not working

Hi,

Please consider the following command:

echo -e "USERNAME\nPASSWORD" | jitsu login && jitsu deploy

The command jitsu login prompts for the username and password.

This command works in the shell but doesn't work with the grunt-shell. Somehow it goes straight to jitsu deploy before the login.

Any idea?

tty.setRawMode error

I'm trying to set up a task on run I've got an error:

Warning: Command failed: tty.setRawMode: Use process.stdin.setRawMode() instead.
� Use --force to continue.

Aborted due to warnings.
Process finished with exit code 6

Maybe some suggestions how to solve this?

Pass a function for command

I am wondering if you see any value in being able to pass a function to the command directive. This function could return a string or a list of strings to be joined for the command to be executed.

The use case I ran into was running a certain shell command for every file in a directory. Passing a function to command could conceivably use fs to read all the files in the directory and return a list of string commands with each file interpolated. I suppose I could make a function and call it inline to achieve this, but are there other potential situations where allowing a function to be passed like this might be desirable?

Is this a valuable contribution?

Does grunt-shell work in PowerShell?

I'm trying to run the command below in grunt-shell via PowerShell and it seems like it doesn't work

$temp = gci . | select -last 1 ; cd $temp.name ; python -m http.server

I've tested it manually in PowerShell and it seems to work just fine, the error I'm getting is this:

'$temp' is not recognized as an internal or external command, operable program or batch file.

relevant part of the Gruntfile.js:

shell: {
    dev: {
        options: {
            stdout: true,
            stderr: true,
            execOptions: {
                cwd: 'dev/'
            }
        },
        command: [
            '$temp = gci . | select -last 1',
            'cd $temp.name',
            'python -m http.server 80'
        ].join(';')
    },
}

edit: after a bit of digging, it seems like grunt-shell runs the commands in cmd.exe even though I'm using PowerShell to execute the grunt task

setRawMode breaks code running with pseudoTTY in Docker

As reported in a comment #74 (comment), setRawMode breaks code running with pseudoTTY in Docker. Since this is the second report about this change breaking sth in a relatively short time, IMO the change should either be backed out or an option for turning it off should be created and set by default to false.

grunt shell reports "Done, without errors" on errors

I have

    shell:
      options: { stdout: true }

      bla1:
        command: "/bin/false"  # will return error code 1

      bla2:
        command: "asdfasdf"    # will return "file not found" and error code 127

When I run those, grunt says:

grunt shell:bla1
Running "shell:bla1" (shell) task

Done, without errors.

What a lie! ;)

This should be fixed, because it is very confusing.

Execution doesn't go to background (truly) with &

test.sh:

#!/bin/bash
echo "Hello"
while [ true ]
do
echo "Test at `date`"
sleep 5
done

If I run it as ./test.sh & it goes to background and I got my console on Enter press.
If I add as a command

test: {
    command: './test.sh &'
}

then it doesn't release. So if I add this task:target as part of another task it will block other tasks execution.

Difficultly exiting from a running coffeescript command

Hey there,

I cant seem to exit from a coffee command. I've tried different killSignal's including 'SIGINT' but not having any luck.
My configuration is pretty simple,

shell: {
  server: {
    command: "coffee server/app.coffee"
  }
}

Anyone have any suggestions? Would be much appreciated.

Cheers

Answear to question

Hey,

I'm building an entry point to multiple command tasks for rails and laravel.

In some tasks i ask user to define some usefull variable or confirm there choice. It's run directly in command tasks because it's based on database interactions.

I'm trying to allow grunt-shell to forward response (keyboard input) to the command but i don't get anything...

my config:

dbCfg.shell.database_proprio_update = {
    command: function () {
      return 'php artisan database:proprio:zero --no-ansi';
    },
    options: {
      stdout: true,
      stdin: true,
      callback: log
    }
  };

I don't know if it's bug or miss understanding...

Thank's for reading me!

Command run terminates even though it should not

I have an index.js app which in short starts up a HTTP server listening on a port.

When I start it up this way NODE_DEBUG="net,http,fs,module,timers" node index.js it works perfectly - simply logging a lot of debug code but waiting for incoming connections.

However, when I run the app by using the following grunt-shell configuration, it writes tons of logs and terminates with exit code 0.

shell: {
    dev: {
        options: {
            stdout: true,
            stderr: true
        },
        command: 'NODE_DEBUG="net,http,fs,module,timers" node index.js'
    }
}

Seems to me like some buffer issue which causes grunt-shell to terminate the command.

stdin not work

Hi
I try to use grunt-shell with 'git commit -a' which will open the vim.

However, I cannot edit the comment.
here is my config in grunt file.
shell: {
commit: {
options: {
stdout: true,
stdin: true,
execOptions: {
env: {
GIT_EDITOR: "vim"
}
}
},
command: [
'git add _.js',
'git add *.json',
'git add www/_.html', // all .html under www
'git commit -a'
].join( '&&' )
}
}

stdout colour

When I run a command usually, the output has colour. If I run it through grunt-shell with the stdout flag set, the colour isn't there…

scape "\" is causing problems with wget

.command = 'wget "ftp://letsgofestas.com.br/*" --ftp-user=user --ftp-password=pass -nc'

When running command with grunt:

image

All bars "/" are converted to "%5C".

How to make a run wget download via FTP?

templating doesn't work with array

I'm trying to iterate through an array, apologies if this is just bad usage:

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

qaHosts:['ipseqa01', 'ipseqa02'],

shell : {
    qa : {
      command : 'scp -i /.ssh/id_rsa -r dist/public/* <%= qaHosts %>:/data/web/static'
    }
}

}

According to my limited understanding, "command" should be run once for each item in qaHosts, no?

Version 0.6.3 requires explicit callback in options

Compiling sockjs via grunt did not work after updating from 0.6.2 to 0.6.3. We have two tasks:

    shell: {
        'npm-install-sockjs': {
            command: 'npm install',
            options: {
                failOnError: true,
                stderr: true,
                stdout: true,
                execOptions: {
                    cwd: 'www/js/lib/bower_components/sockjs-client'
                },
                callback: function () {}
            }
        },
        'make-sockjs': {
            command: './node_modules/.bin/coffee bin/render.coffee --set-version `cat version` lib/all.js > sockjs.js',
            options: {
                failOnError: true,
                stderr: true,
                stdout: true,
                execOptions: {
                    cwd: 'www/js/lib/bower_components/sockjs-client'
                },
                callback: function () {}
            }
        }
    },

They are called as follows:

grunt.registerTask(
    'build-sockjs',
    'Build the SockJS client library.',
    ['shell:npm-install-sockjs', 'shell:make-sockjs']
);

We could only make it work by adding the explicit callback options.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.