DEV Community

Kaspars Dambis
Kaspars Dambis

Posted on • Originally published at kaspars.net on

4 1

Composer, Travis and Bash Source

Today I learned that Composer uses the Symphony Process component for executing the shell commands defined as Composer scripts. This internally calls proc_open() which “opens a process by creating a bidirectional pipe, forking, and invoking the shell”.

I had this script failing on a Travis build with Ubuntu 14.04.5 LTS and PHP 5.6:

{ 
  "scripts": {
    "test": "source scripts/test.sh"
  }
}

with the following error:

sh: 1: source: not found

Turns out that /bin/sh on Ubuntu Trusty is a symlink to /bin/dash:

$ ls -lah /bin/sh lrwxrwxrwx 1 root root 4 Feb 19 2014 /bin/sh -\> dash

And the source command is a bash built-in which simply isn’t available in dash. The solution is to replace all instances of source something.sh with . something.sh (note the space between the dot and the script filename).

Image of Stellar post

🚀 Stellar Dev Diaries Series: Episode 1 is LIVE!

Ever wondered what it takes to build a web3 startup from scratch? In the Stellar Dev Diaries series, we follow the journey of a team of developers building on the Stellar Network as they go from hackathon win to getting funded and launching on mainnet.

Read more

Top comments (0)

AWS Security LIVE! Stream

Stream AWS Security LIVE!

See how AWS is redefining security by design with simple, seamless solutions on Security LIVE!

Learn More

👋 Kindness is contagious

Dive into this thoughtful article, cherished within the supportive DEV Community. Coders of every background are encouraged to share and grow our collective expertise.

A genuine "thank you" can brighten someone’s day—drop your appreciation in the comments below!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found value here? A quick thank you to the author makes a big difference.

Okay