[Gambas-user] More Problems with SHELL (possible BUG).
Stefano Palmeri
rospolosco at ...152...
Thu Jul 5 16:27:22 CEST 2007
Alle 13:58, giovedì 5 luglio 2007, audiossis ha scritto:
> Hello,
>
> I have noticed a problem with using the "SHELL" command to execute console
> functions and then return the output of those functions to a "Process_read"
> sub.
> For the most part this seems to work quite well. When "rm" to remove files
> or when using "cp" to copy files using the code:
>
> PUBLIC SUB something()
>
> SHELL "cp -var /some/directory/some/file /another/directory/another/place"
> WAIT FOR READ
>
> END
>
> PUBLIC SUB Process_read()
>
> DIM sOut AS String
> hStream = OPEN "/path/to/log/file" FOR APPEND
>
> READ #LAST, sOUT, -256
> PRINT #hStream, sOUT
>
> END
>
>
> The output of "cp" is returned and printed to the log file. However this is
> not the case when using "mkdir" with the following code:
>
>
> PUBLIC SUB something()
>
> SHELL "mkdir -v /new/directory" WAIT FOR READ
>
> END
>
> PUBLIC SUB Process_read()
>
> DIM sOut AS String
> hStream = OPEN "/path/to/log/file" FOR APPEND
>
> READ #LAST, sOUT, -256
> PRINT #hStream, sOUT
>
> END
>
>
> This produces absolutely no output to the log file whatsoever. but if I
> remove the "FOR READ" argument I can clearly see the output of the "mkdir"
> in the GAMBAS console. The same can be said for using the "cpio" command to
> create backup archives in the same manner. The command executes but "READ"
> does not receive the output from the command therefore no output is made to
> the log file.
>
> I have also noticed that using "cd" or "pushd" to traverse filesystems is
> difficult at best from within GAMBAS. For example, if I use this code:
>
> SHELL "pushd /directory"
> SHELL "find ./ | cpio -vco | gzip > /path/to/archive/file"
you have to do:
SHELL "pushd /directory; find ./ | cpio -vco | gzip > /path/to/archive/file "
More information about the User
mailing list