Question

I've installed the latest Git Bash (msysgit). If I create a simple ruby file named test.rb with the following content:

#!/usr/bin/env ruby

puts `dir`
puts `ls -al`

Running ruby test.rb will print the directory on the first puts but fail to find ls on the second puts. It is obviously spawning a DOS shell instead of a msysgit shell.

How can I specify that child processes should run under a msysgit shell?

Also, the child shell should inherit the environment variables (specially PATH) from the calling shell.

Was it helpful?

Solution

The answer as of writing is that it isn't possible. A spawn process in msysgit is a CMD process. We can however make the CMD process call a ruby script to work around this limitation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top