Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit 16f6d94de16fd1d33c9b7bf5a864bc41c8da8296 1 parent 2c9dcf5
@tmm1 tmm1 authored
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
3  CHANGELOG.md
@@ -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
2  lib/em/processes.rb
@@ -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
14 tests/test_system.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.