Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Reading stderr from "run"  (Read 976 times)
Jos? V.
Posts: 58


« on: July 12, 2024, 10:09:57 am »

Hello,

I'm trying to execute a shell script using "run" and processing stdout and stderr.
By processing I mean writing stdout to a file and stderr to a string array.
I managed to get stdout by using channel.openpipe and it works fine.

StdErr at the same time is a bit more tricky.
 I've played around with redirecting stdout and stderr to separate files, tried "openPipe", "openFile" but I ran into some issues.

When should I use "dataAvailable" or "isEof"? How do I know the "run" command stopped when executing "without waiting"?

What is the best way to achieve this?

Thanks,
José Virtuoso
Sebastien F.
Four Js
Posts: 528


« Reply #1 on: July 17, 2024, 10:53:20 am »

Hello,

It would help if you provide more context (Genero version, OS, locale, etc)

Errors written to stderr should be an exception.

If you do not need to process stderr output in parallel to stdout output, I would redirect stderr to a file, process stdout and then read from the file containing stderr output.

See attachment.

BR
Seb

* readcmd.zip (0.56 KB - downloaded 105 times.)
Jos? V.
Posts: 58


« Reply #2 on: July 17, 2024, 12:37:55 pm »

Hello Sebastien,

We are using BDL 3.21 on a Linux RedHat 8 on en_US.utf8.

This is to be used on legacy scripts that do some changes on the database(dbaccess/informix) and output a report at the end.
The final goal of this is to get stdout as a file that will later be printed or processed by an external application.
We do not know what the script does, we run the script and process the output.

We consider that stdout is the report to be printed and stderr is other information to show the user, like dbaccess output.

So dbaccess log(stderr) is read and shown to the user on a textedit while the ouput file is being processed(stdout).

I know this looks a bit nonsense since I can inside the script write dbacces log to a file and the output directly where I want.
We are doing it this way because we wan't the conversion of those legacy scripts to GDC/GBC launchables to be as simple as possible(there's thousands of these to migrate).

Hope I'm not being to confusing with the explanation.
Thank you

Olivier E.
Four Js
Posts: 204


« Reply #3 on: July 17, 2024, 04:47:33 pm »

Hello José,

Sorry, I am having difficulties understanding the problem.

May I suggest you open a support ticket from the support portal? After that, you can have a remote discussion and show what you would like to achieve.

Thank you,

Olivier, Four Js Support
Jos? V.
Posts: 58


« Reply #4 on: July 17, 2024, 05:01:04 pm »

Sure, here's the ticker handler: SUPIBERICA-1125

Thank you
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines