Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Kerizer opened this issue Feb 20, 2020 · 4 comments
Closed

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

Kerizer opened this issue Feb 20, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@Kerizer
Copy link

Kerizer commented Feb 20, 2020

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
@Kerizer Kerizer added the bug Something isn't working label Feb 20, 2020
@hrueger
Copy link

hrueger commented Mar 24, 2020

@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.

@hrueger
Copy link

hrueger commented Mar 25, 2020

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

@rickstaa
Copy link

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

WINDOWS:

exec.exec(`cmd /c "my command"`)

@thboop
Copy link
Collaborator

thboop commented Apr 29, 2021

Closing as a dupe of #346

@thboop thboop closed this as completed Apr 29, 2021
akiojin added a commit to akiojin/appcenter-distribute-github-action that referenced this issue Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants