Add isTty and error to access pipes from the public api

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1736010 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/CommandSessionImpl.java b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/CommandSessionImpl.java
index cdffab7..0375a81 100644
--- a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/CommandSessionImpl.java
+++ b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/CommandSessionImpl.java
@@ -742,4 +742,14 @@
         }
 
     }
+
+    @Override
+    public boolean isTty(int fd) {
+        return Pipe.isTty(fd);
+    }
+
+    @Override
+    public void error(int error) {
+        Pipe.error(error);
+    }
 }
diff --git a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Pipe.java b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Pipe.java
index fac281f..274bf28 100644
--- a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Pipe.java
+++ b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Pipe.java
@@ -81,6 +81,11 @@
         return CURRENT.get();
     }
 
+    public static boolean isTty(int fd) {
+        Pipe current = getCurrentPipe();
+        return current != null && !current.toclose[fd];
+    }
+
     public static void error(int error) {
         Pipe current = getCurrentPipe();
         if (current != null) {
diff --git a/gogo/runtime/src/main/java/org/apache/felix/service/command/CommandSession.java b/gogo/runtime/src/main/java/org/apache/felix/service/command/CommandSession.java
index 6794781..01fc644 100644
--- a/gogo/runtime/src/main/java/org/apache/felix/service/command/CommandSession.java
+++ b/gogo/runtime/src/main/java/org/apache/felix/service/command/CommandSession.java
@@ -127,4 +127,18 @@
      */
     void setJobListener(JobListener listener);
 
+    //
+    // Process access
+    //
+
+    /**
+     * Check if the given descriptor for the currently running pipe is the terminal or not.
+     */
+    boolean isTty(int fd);
+
+    /**
+     * Set the error code for the currently running pipe.
+     */
+    void error(int error);
+
 }