Bug #1357

RCP: 0.7.7, JNI CQP std outputs are not redirected to RCP console

Added by Sebastien Jacquot over 4 years ago. Updated over 4 years ago.

Status:New Start date:05/22/2015
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:Debug Spent time: -
Target version:TXM X.X

Description

'cqplib' (JNI CQP) stdout and stderr outputs are not redirected to the TXM RCP log console (neither log file?) when running TXM from a setup.
These outputs are correctly displayed when running TXM from source within the Eclipse IDE.

[SH: We must verify if there are difference of behaviors betweens OSes.
Hypothesis: one hypothesis would be that file I/O channels types (between binary and text mode) could have different behavior with respect to file descriptors flushing (a text typed channel could flush automatically on occurence of '\n' on some OS and not on some others).]
[SJ: The behavior is exactly the same with Mac OS X as with Windows (from setup installation and from Eclipse)]

After some research it seems difficult (impossible?) to precisely manage the output timing and flushing from JNI to Java without modifying the native code.

[SH: what do you mean by 'timing'?, the current cqplib workflow is supposedly as follow:
- TXM Java
- a) call cqpQuery through CQi
- cqplib C
- b) call cqpQuery native C code
- c) some messages can be output to stdout and stderr
- in C output there can be two levels: fprintf (ANSI C high API) and write (Unix kernel low API)
- e) return cqpQuery result

Are we sure to flush in C (output) and in Java (input) every potential stdout and stderr generated at stage c)?]

For example from C code of CQP:
- call Java code inside JNI (e.g. send to a Java stream)
- flush to a file or a pipe from C code consumed by a Java thread (nice example here: http://stackoverflow.com/questions/23352592/redirecting-stdin-and-stdout-of-c-program-in-android)

(For information it seems more simple when running a process rather than using lib through JNI)

[SH: why?]

History

#1 Updated by Sebastien Jacquot over 4 years ago

  • Description updated (diff)

#2 Updated by Sebastien Jacquot over 4 years ago

  • Description updated (diff)

#3 Updated by Serge Heiden over 4 years ago

  • Description updated (diff)

#4 Updated by Sebastien Jacquot over 4 years ago

  • Description updated (diff)

Also available in: Atom PDF