forked from travis-ci/travis-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor worker system call to use bash -c and source the rvm script
- Loading branch information
Sven Fuchs
committed
Apr 15, 2011
1 parent
294d03e
commit 9424f5f
Showing
4 changed files
with
86 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'session' | ||
require 'shellwords' | ||
|
||
cmd = <<-cmd | ||
source ~/.rvm/scripts/rvm | ||
rvm use 1.9.2 | ||
ruby play/worker_test.rb | ||
cmd | ||
|
||
cmd = cmd.strip.split("\n").map do |line| | ||
"echo #{Shellwords.escape("$ #{line}")}\n#{line}" | ||
end.join("\n") | ||
|
||
puts "-- using system('bash -c ...')" | ||
result = system("bash -c '#{cmd}'") | ||
puts "\n" | ||
p result | ||
|
||
puts "\n-- using bash.execute(...)" | ||
bash = Session::Bash.new | ||
bash.execute(cmd) do |out, err| | ||
STDOUT << out if out | ||
STDOUT << err if err | ||
end | ||
|
||
puts "\n" | ||
p bash.exit_status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
STDOUT.sync = true; | ||
|
||
puts "Using RUBY_VERSION: #{RUBY_VERSION}" | ||
|
||
1.upto(100) do | ||
sleep(0.01) | ||
putc '.' | ||
STDOUT.flush | ||
end | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters