commit | a60215ed226e1caef263bef353c4a4dfd1821227 | [log] [tgz] |
---|---|---|
author | Guillaume Nodet <gnodet@apache.org> | Mon Mar 21 16:54:42 2016 +0000 |
committer | Guillaume Nodet <gnodet@apache.org> | Mon Mar 21 16:54:42 2016 +0000 |
tree | f70b905ed93ba6f8dce74d735202f5a0f4e44946 | |
parent | 90e81652a6d532381afe3e30eda9170a436458a3 [diff] |
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); + }