Skip to content

Pipes not working in @actions/exec node module #359

Closed

Description

@Kerizer

Describe the bug
It looks like @actions/exec.exec escapes commands and pipes are not working because of this

To Reproduce
Steps to reproduce the behavior:

  1. Create a new javascript action
  2. Add @actions/exec to project - npm i -s @actions/exec
  3. In your index file add any .exec command with pipe, ie: echo "Hello world" | grep "o"
  4. It would print Hello world" | grep "o", instead of Hell**o** w**o**rld (asterisks here are only for visual purpose, i do not expect them to be in log)
    Screenshot 2020-02-20 at 10 22 40

Expected behavior
Have an option to disable escaping

Screenshots
image

Desktop (please complete the following information):

  • OS: tested on macOS-latest machine
  • Browser [e.g. chrome, safari]
  • Version @actions/exec@1.0.3

Activity

  1. hrueger commented on Mar 24, 2020

    @hrueger

    @Kerizer I have the same problem, the command I want to run is yes | sdkmanager --licenses to automatically accept all prompts with yes. This does not work, it takes | sdkmanager --licenses as one argument and prints that forever until I cancel the workflow.

    A workaround I found is to use /bin/bash -c "my command" , e.g. /bin/bash -c "yes | sdkmanager --licenses". That worked for me.

  2. hrueger commented on Mar 25, 2020

    @hrueger

    As I just found out, this also affects chaining commands with &&...

  3. rickstaa commented on Dec 12, 2020

    @rickstaa

    @hrueger Thanks a lot for the workaround. For future reference here is the windows equivalent:

    WINDOWS:

    exec.exec(`cmd /c "my command"`)
  4. thboop commented on Apr 29, 2021

    @thboop
    Collaborator

    Closing as a dupe of #346

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions