Monday, December 18, 2017

#1 2012-05-30 09:40:33 am

ame
Member
Registered: 2011-06-28
Posts: 151

Different behavior between Script Editor and ASS app

Hi,

I discovered a strange behavior using a simple script between Script Editor and ASS studio app.
Basically I have these lines of code:


set shellScript_1 to "/usr/bin/curl --connect-timeout 30 -m 240 " & ftpMode & "--ftp-create-dirs -T " & filesList & " -u " & ftpUser & ":" & ftpPwd & " " & "ftp://" & ftpHost & ftpDir & folderName & "/"

try
    do shell script shellScript_1
on error msg number errnum
    display dialog "Generic Error"
end try

When I execute it from the Script Editor the try on error catch the error (you can simulate it switching off the FTP server or typing bad pwd.

The exactly same lines of code fails in ASS app.
The dialog "Generic Error" never appear.

Somebody can explain this behavior?

Stefano


Filed under: Script, cURL, ASS, Editor

Offline

 

#2 2012-05-31 08:34:24 am

Matt-Boy
Member
Registered: 2005-10-21
Posts: 480

Re: Different behavior between Script Editor and ASS app

Without seeing all of your code, I have a guess.

Try telling it where to display the dialog.

Tell application "Finder" to display dialog "Generic Error"

Let us know if that makes any difference.

Offline

 

#3 2012-05-31 08:51:22 am

ame
Member
Registered: 2011-06-28
Posts: 151

Re: Different behavior between Script Editor and ASS app

Hi,

I found the source of problem, not yet the solution.

Forget previous email.

the problem seems this:

set shellScript_1 to "/usr/bin/curl --connect-timeout 30 -m 240 " & ftpMode & "--ftp-create-dirs -T " & filesList & " -u " & ftpUser & ":" & ftpPwd & " " & "ftp://" & ftpHost & ftpDir & folderName & "/"

in the quoted array fileList if I have 300 files curl wait 30 seconds for each file and return the final error only at the end of 30*300=9000 seconds.

Anybody can try to reproduce the problem?

I would like to have error if curl can't connect to the server. This should be resolved by "--connect-timeout 30" but probably curl do this for each file to upload.

Any solution?

Stefano

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)