Re: do shell script flaw
Re: do shell script flaw
- Subject: Re: do shell script flaw
- From: "Mark J. Reed" <email@hidden>
- Date: Sat, 5 Dec 2009 21:36:23 -0500
Sure there is. Do shell script "mkdir /goo" will fail if run as
nonroot. "mkdir foo/bar" (no -p) will fail if foo doesn't exist, etc.
Not saying there's no bug, but Its easy to get mkdir to exit with a
nonzero status.
Why not log the error in the on error handler to see what it is?
On Saturday, December 5, 2009, Emmanuel LEVY <email@hidden> wrote:
> Hi Axel, thanks for tactfully giving me an occasion to make myself clearer.
>
> My script runs on idle. It does:
>
> 1. do shell script "top"
> 2. do shell script "ifconfig"
> 3. do shell script "mkdir"
>
> Usually it works all right. Sometimes, what I observe is:
>
> 1. works
> 2. fails, I don't know the error message because the script traps the error (I suppose that it's the same as in 3.)
> 3. fails with "The command exited with a non-zero status", which means a shell scripting error - not a particular command's error
>
> This suggests that 1. has broken do shell script until the script terminates (next "idle" will be a fresh new instance).
>
> For those not familiar, there is indeed no way to trigger "The command exited with a non-zero status" with do shell script "mkdir" let alone do shell script "ifconfig".
>
> Steps 2. and 3. run in many other occasions, and as far as I know they don't break do shell script.
>
> I suppose my problem is to use an interactive command, but I don't really know what this implies. I'm changing for "ps" instead of "top".
>
> Emmanuel
>
>
> On Dec 6, 2009, at 1:01 AM, Axel Luttgens wrote:
>
>
> Le 5 déc. 2009 à 21:50, Emmanuel LEVY a écrit :
>
>
> I wrote too fast. The culprit is most probably a do shell script "top": itself works, but all subsequent calls to do shell script return a "The command exited with a non-zero status" error.
>
> Emmanuel
>
>
> Hello Emmanuel,
>
> Nice to meet you again.
>
> Yes, it would very be interesting to have the smallest piece of code liable to reproduce the problem.
> I ask because your initial report made me think very hard, without being sure to have fully understood the symptom you described. But it's possibly only me... ;-)
>
> TIA,
> Axel
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
>
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden