Giter VIP home page Giter VIP logo

Comments (7)

Grynn avatar Grynn commented on June 6, 2024 2

I tried with the following which worked:

demo.sh:

#!/bin/sh

set -x

VAR=`cat /dev/stdin`
echo $VAR

The set -x produces useful logs.

Another issue:
Assumes that demo.sh is on the same host as docker (usually not the case on macOS).

from webify.

mschirrmeister avatar mschirrmeister commented on June 6, 2024

It seems the code pipes the http body to the script. So you have to use stdin instead of $1.
If that is good or the correct way, I am not sure.

Try the following in your bash script.

VAR="$(< /dev/stdin)"
echo $VAR

from webify.

mihaigalos avatar mihaigalos commented on June 6, 2024

Thanks for the idea, I've updated my initial minimal demo with what I've tried. Didn't work yet.

from webify.

beefsack avatar beefsack commented on June 6, 2024

Hi @mihaigalos, can you try using #!/bin/bash instead of #!/bin/sh?

from webify.

mihaigalos avatar mihaigalos commented on June 6, 2024

Hi @beefsack, I've tried that before asking. Can you reproduce it?

from webify.

mschirrmeister avatar mschirrmeister commented on June 6, 2024

@mihaigalos Good question why it did not work for you. It worked for me with stdin, but I did not used docker. I just ran it natively on my Mac.

from webify.

mihaigalos avatar mihaigalos commented on June 6, 2024

Thank you @Grynn - confirmed working in docker with your changes!

from webify.

Related Issues (14)

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.