Skip to content

Commit

Permalink
Showing 2 changed files with 16 additions and 16 deletions.
9 changes: 5 additions & 4 deletions core/src/main/java/org/jruby/util/io/PopenExecutor.java
Original file line number Diff line number Diff line change
@@ -1847,12 +1847,13 @@ public int compare(String o1, String o2) {
List<byte[]> argv_buf = new ArrayList<>();
pBytes = prog.getByteList().unsafeBytes();
p = prog.getByteList().begin();
while (p < pBytes.length){
while (p < pBytes.length && (pBytes[p] == ' ' || pBytes[p] == '\t'))
int pEnd = prog.getByteList().length() + p;
while (p < pEnd){
while (p < pEnd && (pBytes[p] == ' ' || pBytes[p] == '\t'))
p++;
if (p < pBytes.length){
if (p < pEnd){
int w = p;
while (p < pBytes.length && pBytes[p] != ' ' && pBytes[p] != '\t')
while (p < pEnd && pBytes[p] != ' ' && pBytes[p] != '\t')
p++;
argv_buf.add(Arrays.copyOfRange(pBytes, w, p));
eargp.argv_buf = argv_buf;
23 changes: 11 additions & 12 deletions test/jruby/test_backquote.rb
Original file line number Diff line number Diff line change
@@ -25,19 +25,18 @@ def test_system_special_commands
end
end

# GH #2047 backquote fails with null byte ArgumentError
#JRUBY-2251
# def test_empty_backquotes
# if (!WINDOWS)
# assert_raise(Errno::ENOENT) {``}
# assert_raise(Errno::ENOENT) {` `}
# assert_raise(Errno::ENOENT) {`\n`}
# else # we just check that empty backquotes won't blow up JRuby
# `` rescue nil
# ` ` rescue nil
# `\n` rescue nil
# end
# end
def test_empty_backquotes
if (!WINDOWS)
assert_raise(Errno::ENOENT) {``}
assert_raise(Errno::ENOENT) {` `}
assert_raise(Errno::ENOENT) {`\n`}
else # we just check that empty backquotes won't blow up JRuby
`` rescue nil
` ` rescue nil
`\n` rescue nil
end
end

# http://jira.codehaus.org/browse/JRUBY-1557
def test_backquotes_with_redirects_pass_through_shell

0 comments on commit 4b2c130

Please sign in to comment.