• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Another shell script query
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another shell script query


  • Subject: Re: Another shell script query
  • From: Christopher Nebel <email@hidden>
  • Date: Thu, 6 Jun 2002 11:13:57 -0700

On Thursday, June 6, 2002, at 10:15 AM, garbanzito wrote:

1) if the shell command has a normal exit status (0), then stderr is ignored and stdout is returned.

Right. This is normal for shell escapes in most languages.

2) if the shell command has a non-zero exit status, an error is thrown, and the error message is stderr, the error number is the exit status, and stdout is unavailable. ... however, somehow "curl --help" doesn't follow this pattern. can someone explain this?

curl --help always writes its output to stdout; the problem is that "do shell script" is being clever. If a command returns a non-zero status, it will return stderr as the error text *unless* stderr is empty, in which case it returns stdout as the error text. This is yet another one of those things about "do shell script" which is sort of bizarre, but we'll probably never change (at least in AppleScript 1.x), because people are relying on it.

also, desirable for future versions of AppleScript:
- put stdout into partial result in case of an error
- a way to retrieve stderr if exit status is zero

You can do the latter today by using 2>&1; the former is a very good idea -- please write a bug.


--Chris Nebel
AppleScript Engineering
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Another shell script query (From: garbanzito <email@hidden>)

  • Prev by Date: Re: Another shell script query
  • Next by Date: hmmm... did I ask too many questions?
  • Previous by thread: Re: Another shell script query
  • Next by thread: Re: Another shell script query
  • Index(es):
    • Date
    • Thread