Skip to main content
Known Participant
February 26, 2023
Question

Determine why external app call fails

  • February 26, 2023
  • 1 reply
  • 442 views

I'm creating an export plugin that calls an external app at the end of the export.  When I call it with 

local exitCode =LrTasks.execute(command)
it returns exit code 255.  I log the command and execute it from the terminal, and it works fine, returning exit code 0.  How might I diagnose the problem?
 
Thanks in advance!
This topic has been closed for replies.

1 reply

PaulWaldoAuthor
Known Participant
February 26, 2023

Update:

It appears that it is not the constructed command that is bad, it is something more fundamental in my construction.  This code also fails with a return code of 256

	quotedCommand = "pwd"
	local exitCode = LrTasks.execute(quotedCommand)
 
johnrellis
Legend
February 26, 2023

Hmm, when I execute these lines in a script in the Scripts folder:

local LrTasks = import "LrTasks"

quotedCommand = "pwd > ~/Desktop/test.log"
local exitCode = LrTasks.execute (quotedCommand)

the file "test.log" is created and the exitCode is 0.

 

As a next step, I suggest making a stripped down test export plugin with just the LrTasks.execute() line and post it here. I can poke around to see what might be the hangup.

 

 

 

PaulWaldoAuthor
Known Participant
February 26, 2023

Thank you for your suggestion John.  It turns out that error code was indeed valid *when run from Lightroom*. The thing that stumped me was that running it exactly as constructed on the command line ran fine.  Your suggestion about redirecting the output got thinking.  I had to look at stderr to find the answer

my_cmd &> ~/log.txt

 That indeed bore fruit.  My command produced the message 

"Unable to open output image \"out.jpg\": open out.jpg: read-only file system"

I need to put a full path on the output image created by my command.  Thanks so much for the suggestion!