a ha, that's good

Best regards,
Xuan Wang
________________________________
From: Christofer Dutz <christofer.d...@c-ware.de>
Sent: Wednesday, January 10, 2024 9:14:21 PM
To: dev@iotdb.apache.org <dev@iotdb.apache.org>
Subject: AW: [DISCUSS] Refactor the CLI to allow passing in STDIN, STDOUT and 
STDERR?

JLine just takes the PrintStream and the InputStream … it shouldn’t matter 
where it’s coming from.

Chris

Von: Wang Critas <cri...@outlook.com>
Datum: Mittwoch, 10. Januar 2024 um 13:36
An: dev@iotdb.apache.org <dev@iotdb.apache.org>
Betreff: Re: [DISCUSS] Refactor the CLI to allow passing in STDIN, STDOUT and 
STDERR?
hi Chris,

only modify the in/out stream, not sure if it works well with jline

Best regards,
Xuan Wang

________________________________
发件人: Christofer Dutz <christofer.d...@c-ware.de>
发送时间: 2024年1月10日星期三 20:29
收件人: dev@iotdb.apache.org <dev@iotdb.apache.org>
主题: AW: [DISCUSS] Refactor the CLI to allow passing in STDIN, STDOUT and STDERR?

Hi Wang,

I am planning on doing this change, so it should have no affect on how it 
works, just where it gets it’s variables from ;-) But sure … testing is always 
good :-)

Chris

Von: Wang Critas <cri...@outlook.com>
Datum: Mittwoch, 10. Januar 2024 um 11:41
An: dev@iotdb.apache.org <dev@iotdb.apache.org>
Betreff: 回复: [DISCUSS] Refactor the CLI to allow passing in STDIN, STDOUT and 
STDERR?
Hi

It looks good, but compatibility may require some testing. For example, various 
versions of Windows.

Xuan Wang

________________________________
发件人: Christofer Dutz <christofer.d...@c-ware.de>
发送时间: 2024年1月10日 17:59
收件人: dev@iotdb.apache.org <dev@iotdb.apache.org>
主题: [DISCUSS] Refactor the CLI to allow passing in STDIN, STDOUT and STDERR?

Hi all,

I would love to be able to provide a Web-Based CLI. Usually, this sort of thing 
works by forwarding stdin, stdout and stderr to a remote client. I’m working on 
building a Web CLI for IoTDB, which I could integrate into a browser 
application.

I could do this by globally redirecting System.stdout … but in that case I’d be 
forwarding also Log output (if that’s logged to STDOUT) … so I would love to 
refactor the CLI to allow passing in explicit streams for all of these and to 
simply have the “main” method initialize these:

public static void main(String[] args) throws ClassNotFoundException, 
IOException {
  InputStream in = System.in;
  PrintStream out = System.out;
  PrintStream err = System.err;
  mainInternal(args, in, out, err);
}

public static void mainInternal(String[] args, InputStream in, PrintStream out, 
PrintStream err) throws ClassNotFoundException, IOException {

In that case I could call mainInternal (or whatever we name it) and pass in 
dedicated streams, which I redirect to the browser.

In that case I we would need to refactor all of the usages of System.out, 
System.in etc to use these passed along streams instead.

What do you folks think?

Chris

Reply via email to