• 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: Wait Until Process Completion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wait Until Process Completion


  • Subject: Re: Wait Until Process Completion
  • From: Christopher Nebel <email@hidden>
  • Date: Tue, 13 May 2008 03:02:31 -0700

Actually, "do shell script" has always propagated errors like that. The difference is that ps(1) in Leopard returns a status of 1 if you use -p with a non-existent pid, where it returned 0 in Tiger. This isn't mentioned in the man page at all, but I'd guess that it's one of the many POSIX conformance changes in Leopard.


--Chris Nebel AppleScript Engineering

On May 12, 2008, at 6:55 PM, Mark J. Reed wrote:

When ps can't find the requested pid, it exits with nonzero status,
signalling an error. In Leopard, "do shell script" propagates such
shell errors into AppleScript errors.  This makes it easier for AS to
take advantage of the many shell tools that produce no output but
instead signal a condition via their exit status, without having to do
something extra within the shell command line..

On 5/12/08, Luther Fuller <email@hidden> wrote:

The following worked correctly in Tiger.

	repeat
		delay 1
		do shell script "ps -p " & pid --<<<<
		if not (the result contains pid) then exit repeat
	end repeat

But, in Leopard, the line marked --<<<< errors (= 1) and my script
stops.
So, I replaced it with ...

	repeat
		delay 1
		try
			do shell script "ps -p " & pid
		on error
			exit repeat
		end try
	end repeat

and now my script is again working correctly. But why?
Something has changed its behavior.
Does anyone know what's going on here?
_______________________________________________
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
  • Follow-Ups:
    • Re: Wait Until Process Completion
      • From: "Mark J. Reed" <email@hidden>
References: 
 >Wait Until Process Completion (From: Luther Fuller <email@hidden>)
 >Re: Wait Until Process Completion (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: RE: Simple newbie question
  • Next by Date: Re: Wait Until Process Completion
  • Previous by thread: Re: Wait Until Process Completion
  • Next by thread: Re: Wait Until Process Completion
  • Index(es):
    • Date
    • Thread