From 57805dd09f2311f593ec2986121eb279d5881dba Mon Sep 17 00:00:00 2001 From: benfry Date: Mon, 27 Oct 2003 04:09:25 +0000 Subject: [PATCH] linux tweak, and improving the speed of siphoning System.out --- processing/app/PdeMessageSiphon.java | 11 ++++++++--- processing/app/PdeRuntime.java | 14 +++++++++++++- processing/todo.txt | 5 ++--- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/processing/app/PdeMessageSiphon.java b/processing/app/PdeMessageSiphon.java index 2927b6fb0..f1cd419bb 100644 --- a/processing/app/PdeMessageSiphon.java +++ b/processing/app/PdeMessageSiphon.java @@ -56,9 +56,14 @@ class PdeMessageSiphon implements Runnable { //System.err.println(currentLine); } } catch (Exception e) { - System.err.println("PdeMessageSiphon err " + e); - e.printStackTrace(); - //thread.stop(); // implicit (and no longer supported) + // on linux, a "bad file descriptor" message comes up when + // closing an applet that's being run externally. + // use this to cause that to fail silently since not important + if ((PdeBase.platform != PdeBase.LINUX) || + (e.getMessage().indexOf("Bad file descriptor") == -1)) { + System.err.println("PdeMessageSiphon err " + e); + e.printStackTrace(); + } } //System.err.println("siphon thread exiting"); } diff --git a/processing/app/PdeRuntime.java b/processing/app/PdeRuntime.java index db437249c..9e97ca9ac 100644 --- a/processing/app/PdeRuntime.java +++ b/processing/app/PdeRuntime.java @@ -75,12 +75,24 @@ public class PdeRuntime implements PdeMessageConsumer { thread.start(); } - public void run() { + public void run() { + byte boofer[] = new byte[1024]; + try { + while (true) { + //int count = input.available(); + //int offset = 0; + int count = input.read(boofer, 0, boofer.length); + if (count == -1) break; + System.out.print(new String(boofer, 0, count)); + } + + /* int c; while ((c = input.read()) != -1) { System.out.print((char) c); } + */ } catch (Exception e) { System.err.println("PdeSystemOutSiphon error " + e); e.printStackTrace(); diff --git a/processing/todo.txt b/processing/todo.txt index 2b2f81a20..5e3e8646a 100644 --- a/processing/todo.txt +++ b/processing/todo.txt @@ -23,12 +23,11 @@ X open the discourse board in another window, ask to post the code X set PATH to include java (!) X external classes currently require expert release -_ code written for linux, test it +X code written for linux, test it _ code written for windows, rebuild the exe and test it - _ update the release of jikes that's used X updated for macosx -_ compile new version for linux +X compile new version for linux _ compile new version for windows _ netscape/javascript had to be included for linux and for expert