4D 2003 and shell execute not working properly.

27 views
Skip to first unread message

Jorge

unread,
Sep 6, 2009, 6:59:58 AM9/6/09
to 4D-Tech
Hi,

Please help me. I'm stuck. I wonder why I'm not getting any data back,
neither in $err nor in $0. The code is:

C_TEXT($0;$1;$comandoShell)
C_LONGINT($error)

$comillas:=Char(Double quote )
$comandoShell:="echo "+$comillas+"This is a test"+$comillas+" |
openssl enc -d -base64"

$error:=TBX Execute In Shell ($comandoShell;$0)
$error:=USE_ShellExecute ($comandoShell;$0)

The command into $comandoShell runs fine in the terminal:

echo "This is a test" | openssl enc -base64
gives "VGhpcyBpcyBhIHRlc3QK", but I'm getting nothing back into $0 !

I'm running 4D 2003 on a G4 with OSX 10.4.11. The plugins to access
the shell I'm trying it with are:

4DToolBox : http://www.rosedev.nl/products/product.php?id=4
USE Shell : http://4d.use.pl/

Any ideas please ?
Thanks in advance,

Cheers,
--
Jorge.

Jorge

unread,
Sep 9, 2009, 1:32:27 PM9/9/09
to 4D-Tech
On Sep 6, 12:59 pm, Jorge <jo...@jorgechamorro.com> wrote:
> $comillas:=Char(Double quote )
> $comandoShell:="echo "+$comillas+"This is a test"+$comillas+" |
> openssl enc -d -base64"
>
> $error:=TBX Execute In Shell ($comandoShell;$0)
> $error:=USE_ShellExecute ($comandoShell;$0)
>
> The command into $comandoShell runs fine in the terminal:
>
> echo "This is a test" | openssl enc -base64
> gives "VGhpcyBpcyBhIHRlc3QK", but I'm getting nothing back into $0 !

The problem was that $0 should not be passed directly to the Execute
In Shell call, any other intermediate text var would do, e.g.:

$error:=TBX Execute In Shell ($comandoShell;$reply)
$0:=$reply

--
Jorge.

David Dancy

unread,
Sep 9, 2009, 6:58:07 PM9/9/09
to 4d-...@googlegroups.com
Hmmm... I think this is a general problem with 4D's method parameters.
They _look_ like local variables, and in some ways behave like them,
but they _aren't actually_ the same. So you can't use them in all of
the same situations, especially in places like plugins methods that
are expecting to be able to put a result back into the variable. The
Plugin API doesn't know how to handle that situation, so going through
an intermediary local or process variable is the best strategy.

2009/9/10 Jorge <jo...@jorgechamorro.com>:


> The problem was that $0 should not be passed directly to the Execute
> In Shell call, any other intermediate text var would do, e.g.:
>
> $error:=TBX Execute In Shell ($comandoShell;$reply)
> $0:=$reply
>


--
David Dancy
Sydney, Australia

Jorge

unread,
Sep 10, 2009, 10:40:26 AM9/10/09
to 4D-Tech
On Sep 10, 12:58 am, David Dancy <david.da...@gmail.com> wrote:
> Hmmm... I think this is a general problem with 4D's method parameters.
> They _look_ like local variables, and in some ways behave like them,
> but they _aren't actually_ the same. So you can't use them in all of
> the same situations, especially in places like plugins methods that
> are expecting to be able to put a result back into the variable. The
> Plugin API doesn't know how to handle that situation, so going through
> an intermediary local or process variable is the best strategy.

Yes. I had to learn that the hard way :-)
And, in this case, $reply could have better been of type blob not
text.

Thanks,
--
Jorge.
Reply all
Reply to author
Forward
0 new messages