System >>performOnServer:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

System >>performOnServer:

GLASS mailing list

I find the behaviour of this model regarding error-checks strange. The following implementation throws an error if the script returns a value > 0 and sometimes the error message is on standard out and not on the error out.


Marten


| resultStr arr childStatus |
arr := System _performOnServer: aString .
resultStr := arr at: 3 .
  childStatus := arr at: 2 .
(resultStr isNil or:[ childStatus > 0 ])
    ifTrue:[  | rawStatus  errno errMsg |
        rawStatus := arr at: 1 .
        errno := arr at: 5 .
        (errMsg := arr at: 4) isNil
            ifTrue:[ aString _error: #hostErrPerform args:{ resultStr . errno . rawStatus . childStatus } ]
            ifFalse:[ aString _error: #hostErrPerform args:{ errMsg . errno . rawStatus . childStatus } ].
        ^ nil
    ].

resultStr _stringCharSize == 0 ifTrue:[
  ^ resultStr decodeToString  "decode a Utf8"
].
^ resultStr


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: System >>performOnServer:

Richard Sargent
Administrator
Marten wrote
I find the behaviour of this model regarding error-checks strange. The following implementation throws an error if the script returns a value > 0 and sometimes the error message is on standard out and not on the error out.
Hi Marten,

How would you expect it to work / like it to work?
0 versus >0 is the Unix convention for success/error. Not all programs follow this convention.
Some programs write errors on stdout; most on stderr.
Reply | Threaded
Open this post in threaded view
|

Re: System >>performOnServer:

GLASS mailing list

At least following the convention: >0 for error. As an example if you try to start a program and you have not installed it yet - you get an error 127 from the shell. The default implementation does not throw an error in this case.

But I see the problems ...


Marten


Richard Sargent via Glass <[hidden email]> hat am 18. August 2016 um 17:46 geschrieben:


Marten wrote

I find the behaviour of this model regarding error-checks strange. The
following implementation throws an error if the script returns a value > 0
and sometimes the error message is on standard out and not on the error
out.

Hi Marten,

How would you expect it to work / like it to work?
0 versus >0 is the Unix /convention/ for success/error. Not all programs
follow this convention.
Some programs write errors on stdout; most on stderr.




--
View this message in context: http://forum.world.st/System-performOnServer-tp4911556p4911765.html
Sent from the GLASS mailing list archive at Nabble.com.
_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass