Highlighted

Plugin programming: read output stream from external binary

Feb 25, 2020

Copy link to clipboard

Copied

Hello

 

I'm writing a LR plugin and need to execute an external binary (ImageMagick). I want to read the output of the binary. But unlike the LUA io.popen function the LrTasks.execute reports only the returncode and not the output stream of the external binary.

Is the only way to get the external output into lightroom using a temporary file?

LrTasks.execute ( 'magick.exe > c:\tmp\output' )
output = LrFileUtils.readFile( 'c:\tmp\output' )

Or is there a better way?

 

Bye

Marcus

 

Most Valuable Participant
Correct answer by johnrellis | Most Valuable Participant

"Is the only way to get the external output into lightroom using a temporary file?"

 

That's right. Make sure you capture stderr as well as stdout if you want to check for errors (programs don't always set a return status code, unfortunately).

 

[Use the reply button under the first post to ensure replies sort properly.]

Topics

SDK

Views

69

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Plugin programming: read output stream from external binary

Feb 25, 2020

Copy link to clipboard

Copied

Hello

 

I'm writing a LR plugin and need to execute an external binary (ImageMagick). I want to read the output of the binary. But unlike the LUA io.popen function the LrTasks.execute reports only the returncode and not the output stream of the external binary.

Is the only way to get the external output into lightroom using a temporary file?

LrTasks.execute ( 'magick.exe > c:\tmp\output' )
output = LrFileUtils.readFile( 'c:\tmp\output' )

Or is there a better way?

 

Bye

Marcus

 

Most Valuable Participant
Correct answer by johnrellis | Most Valuable Participant

"Is the only way to get the external output into lightroom using a temporary file?"

 

That's right. Make sure you capture stderr as well as stdout if you want to check for errors (programs don't always set a return status code, unfortunately).

 

[Use the reply button under the first post to ensure replies sort properly.]

Topics

SDK

Views

70

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
Feb 26, 2020

Copy link to clipboard

Copied

"Is the only way to get the external output into lightroom using a temporary file?"

 

That's right. Make sure you capture stderr as well as stdout if you want to check for errors (programs don't always set a return status code, unfortunately).

 

[Use the reply button under the first post to ensure replies sort properly.]

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...