about summary refs log tree commit homepage
path: root/test/test_player_integration.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2014-12-27 04:39:00 +0000
committerEric Wong <e@80x24.org>2014-12-27 04:39:00 +0000
commit059f0d72aa4663f851187dd98b78a8fda4ce7767 (patch)
tree4d4b37b1bec6ce07656d9533eea58c20915082b4 /test/test_player_integration.rb
parent51c0beacc5e38ff8129c028615ea05cfe275fbce (diff)
downloaddtas-059f0d72aa4663f851187dd98b78a8fda4ce7767.tar.gz
Process.spawn allows vfork() + execve() usage in Ruby 2.2.0 to
improve performance over normal fork() + execve().
Diffstat (limited to 'test/test_player_integration.rb')
-rw-r--r--test/test_player_integration.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/test/test_player_integration.rb b/test/test_player_integration.rb
index d4bae8d..66f599e 100644
--- a/test/test_player_integration.rb
+++ b/test/test_player_integration.rb
@@ -5,10 +5,9 @@ class TestPlayerIntegration < Testcase
   include PlayerIntegration
 
   def test_cmd_rate
-    pid = fork do
-      @fmt.to_env.each { |k,v| ENV[k] = v }
-      exec("sox -n $SOXFMT - synth 3 pinknoise | #@cmd")
-    end
+    env = ENV.to_hash.merge(@fmt.to_env)
+    cmd = "sox -n $SOXFMT - synth 3 pinknoise | #@cmd"
+    pid = Process.spawn(env, cmd)
     t = Time.now
     _, _ = Process.waitpid2(pid)
     elapsed = Time.now - t