Skip to main content.
home | support | download

Back to List Archive

Re: Swish 2.2 termination status values.

From: <moseley(at)not-real.hank.org>
Date: Fri Sep 12 2003 - 12:11:18 GMT
On Fri, Sep 12, 2003 at 10:49:24AM +0100, William Bailey wrote:
> Sorry Bill but thats not what i ment. :(
> 
> I understand that if err: is in the output then something has gone wrong 
> (unless its no results). What i was really talking about some kind of return 
> status value.
> 
> Was thinking about something like this:
> 
> #include <stdlib.h>
> exit( status );
> 
> Where:
> 
> int status;
>     is a status that will be returned to whatever called the current program. 

I understood what you were asking.  That's what I was demonstrating with
the `echo "bad"' below.


> At the moment i'm reading the output to find errors and matching the string 
> value to find out exactly what error was just thrown. It works but if any 
> changes are made to the output description then i need to amend the php 
> class. If there is a different exit status for the different err types then 
> it would make scripting with swish-e a lot more friendly in any language that 
> can return the exit status of the application that was just run.

I tend to gather all output and look for a pattern like /^err: (.)+$/ 
and also check for a non-zero return value.  But err: no results is not 
an error condition.

> For example you could have:
> 
> exit status:-      What:-
>   0                  Good, Results
>   1                  Good, No Results
>   2                  Bad, Unknown switch
>   ...                ...

Well, it has not been documented yet.  But now it's

    0  = no errors, but maybe no results
    1  = error

I could maybe see changing to 

    0  = ok
    1  = no results
    2  = error

but I'd worry that might break some existing code (I think I have code 
that looks at the exit value).

But for general errors you will be better parsing the output, I think.




> 
> Hope this makes things a bit more clear.
> 
> On Thursday 11 September 2003 15:11, Bill Moseley wrote:
> > On Thu, Sep 11, 2003 at 02:16:34AM -0700, William Bailey wrote:
> > > Does anybody know where i can find any documentation about the
> > > termination status that swish return when it finishes running?
> >
> > # SWISH format: 2.4.0-pr2
> > # Search words: foo
> > # Removed stopwords:
> > err: no results
> > .
> > moseley@bumby:~$ swish-e -q foo || echo "bad"
> > err: Unknown switch '-q'.  Use -h for options.
> > .
> > bad
> >
> > moseley@bumby:~$ swish-e -i 1.html -v0|| echo "bad"
> > moseley@bumby:~$ swish-e -i 1xx.html -v0|| echo "bad"
> >
> > Warning: Invalid path '1xx.html': No such file or directory
> > err: No unique words indexed!
> > .
> > bad
> 
> -- 
> Regards,
> 	William Bailey.
> 	Pro-Net Internet Services Ltd.
> 	http://www.pro-net.co.uk/
> 

-- 
Bill Moseley
moseley@hank.org
Received on Fri Sep 12 12:11:48 2003