Permalink
Browse files

fix EM.system (cc #322) (closes #413)

  • Loading branch information...
tmm1 committed Mar 8, 2013
1 parent 2c9dcf5 commit 16f6d94de16fd1d33c9b7bf5a864bc41c8da8296
Showing with 18 additions and 1 deletion.
  1. +3 −0 CHANGELOG.md
  2. +1 −1 lib/em/processes.rb
  3. +14 −0 tests/test_system.rb
View
@@ -1,5 +1,8 @@
# Changelog
+## 1.0.x
+* EM.system was broken in 1.0.2 release [#413]
+
## 1.0.2 (March 8, 2013)
* binary win32 gems now include fastfilereader shim [#222]
* fix long-standing connection timeout issues [27fdd5b, igrigorik/em-http-request#222]
View
@@ -114,7 +114,7 @@ def EventMachine::system cmd, *args, &cb
init = args.pop if args.last.is_a? Proc
# merge remaining arguments into the command
- cmd = [cmd, *args]
+ cmd = [cmd, *args] if args.any?
EM.get_subprocess_pid(EM.popen(cmd, SystemCmd, cb) do |c|
init[c] if init
View
@@ -22,6 +22,20 @@ def test_system
assert_equal(@test_data, result)
end
+ def test_system_with_string
+ result = nil
+ status = nil
+ EM.run {
+ EM.system("cat '#@filename'"){|out, state|
+ result = out
+ status = state.exitstatus
+ EM.stop
+ }
+ }
+ assert_equal(0, status)
+ assert_equal(@test_data, result)
+ end
+
def teardown
File.unlink(@filename)
end

0 comments on commit 16f6d94

Please sign in to comment.