Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix writefh on JVM to not emit trailing nullbytes.
  • Loading branch information
jnthn committed Sep 25, 2013
1 parent 76820d4 commit ced8450
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java
Expand Up @@ -518,8 +518,10 @@ public static SixModelObject writefh(SixModelObject obj, SixModelObject buf, Thr
ByteBuffer bb = decode8(buf, tc);
if (obj instanceof IOHandleInstance) {
IOHandleInstance h = (IOHandleInstance)obj;
byte[] bytesToWrite = new byte[bb.limit()];
bb.get(bytesToWrite);
if (h.handle instanceof IIOSyncWritable)
((IIOSyncWritable)h.handle).write(tc, bb.array());
((IIOSyncWritable)h.handle).write(tc, bytesToWrite);
else
throw ExceptionHandling.dieInternal(tc,
"This handle does not support write");
Expand Down

0 comments on commit ced8450

Please sign in to comment.