|
44 | 44 | import org.perl6.nqp.io.IIOCancelable;
|
45 | 45 | import org.perl6.nqp.io.IIOClosable;
|
46 | 46 | import org.perl6.nqp.io.IIOEncodable;
|
| 47 | +import org.perl6.nqp.io.IIOExitable; |
47 | 48 | import org.perl6.nqp.io.IIOInteractive;
|
48 | 49 | import org.perl6.nqp.io.IIOLineSeparable;
|
49 | 50 | import org.perl6.nqp.io.IIOSeekable;
|
50 | 51 | import org.perl6.nqp.io.IIOSyncReadable;
|
51 | 52 | import org.perl6.nqp.io.IIOSyncWritable;
|
52 | 53 | import org.perl6.nqp.io.ProcessHandle;
|
| 54 | +import org.perl6.nqp.io.ProcessChannel; |
53 | 55 | import org.perl6.nqp.io.ServerSocketHandle;
|
54 | 56 | import org.perl6.nqp.io.SocketHandle;
|
55 | 57 | import org.perl6.nqp.io.StandardReadHandle;
|
@@ -755,6 +757,24 @@ public static SixModelObject closefh(SixModelObject obj, ThreadContext tc) {
|
755 | 757 | return obj;
|
756 | 758 | }
|
757 | 759 |
|
| 760 | + public static long closefhi(SixModelObject obj, ThreadContext tc) { |
| 761 | + if (obj instanceof IOHandleInstance) { |
| 762 | + IOHandleInstance h = (IOHandleInstance)obj; |
| 763 | + if (h.handle instanceof IIOClosable |
| 764 | + && h.handle instanceof IIOExitable) { |
| 765 | + ((IIOClosable)h.handle).close(tc); |
| 766 | + return (long)((IIOExitable)h.handle).exitValue(tc); |
| 767 | + } |
| 768 | + else |
| 769 | + throw ExceptionHandling.dieInternal(tc, |
| 770 | + "This handle does not support close or exitValue"); |
| 771 | + } |
| 772 | + else { |
| 773 | + die_s("closefhi requires an object with the IOHandle REPR", tc); |
| 774 | + } |
| 775 | + return -1; |
| 776 | + } |
| 777 | + |
758 | 778 | public static Set<PosixFilePermission> modeToPosixFilePermission(long mode) {
|
759 | 779 | Set<PosixFilePermission> perms = EnumSet.noneOf(PosixFilePermission.class);
|
760 | 780 | if ((mode & 0001) != 0) perms.add(PosixFilePermission.OTHERS_EXECUTE);
|
|
0 commit comments