[Gambas-user] More Problems with SHELL (possible BUG).

audiossis audiossis at ...867...
Fri Jul 6 13:30:27 CEST 2007


On Friday 06 July 2007 19:05:47 audiossis wrote:
> On Friday 06 July 2007 17:56:13 gambas-user-request at lists.sourceforge.net wrote:
> > Message: 8
> > Date: Fri, 6 Jul 2007 09:56:23 +0200
> > From: Stefano Palmeri <rospolosco at ...152...>
> > Subject: Re: [Gambas-user] More Problems with SHELL (possible BUG).
> > To: mailing list for gambas users <gambas-user at lists.sourceforge.net>
> > Message-ID: <200707060956.23576.rospolosco at ...152...>
> > Content-Type: text/plain;  charset="iso-8859-1"
> > 
> > Alle 09:18, venerd? 6 luglio 2007, audiossis ha scritto:
> > > Thanks Stefano for your suggestion but unfortunately I have to report that
> > > it made no difference. I should at this point mention that I have tried
> > > re-directing the output  of both "mkdir" and "cpio" by using code like:
> > >
> > > SHELL "mkdir -v /new/directory >/dev/stdout" WAIT FOR READ
> > >
> > > and
> > >
> > > SHELL "mkdir -v /new/directory >/dev/console" WAIT FOR READ
> > >
> > >
> > > Your suggestion made sense but I don't think that the problem lies with the
> > > direction (or lack thereof) of output from the shell programs but rather
> > > the content of their returns. I wonder if the output of these programs
> > > begins with a null character (or other non-printable character) that is
> > > confusing the "READ" argument? or if there is a timing problem that
> > > prevents "READ" from acquiring the first byte of returned data?
> > >
> > > Ben
> > 
> > You're right. I don't know. I tried with gambas 1.9.49:
> > 
> > PUBLIC SUB _new()
> >   
> >   SHELL "mkdir -v hello >&1 | head -c5" 
> >       
> > END
> > 
> > 'head' doesn't work. Also
> > 
> > PUBLIC SUB _new()
> >   
> >   DIM sOutput AS String
> >   
> >   SHELL "mkdir -v hello >&1" TO sOutput
> >   PRINT sOutput
> >       
> > END
> >   
> > sOutput is blank. 
> > 
> > Very strange. Probably a bug(?).
> > 
> > Stefano
> 
> 
> I too am using 1.9.49 and have it installed on a dual head Fedora Core 6 setup (I don't know that that makes any difference).
> Unfortunately I don't know how to program in C, otherwise I'd have a go at fixing it myself...
> I guess I just wait to see if it is fixed next version......? :-|
> 
> Thanks for your time Stefano :-)
> 
> BTW... I'm still open to suggestions!
> 
> Ben
> 

HA! I've figured out at least part of the problem!! It's not a bug with GAMBAS, rather you were right Stefano!
"mkdir" is NOT returning it's output to stdout.

I've found that doing this works:



PUBLIC SUB something()

SHELL "mkdir -v /new/directory 2> /dev/stdout" 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


Unfortunately though this doesn't work for "cpio" but it's a good start!!

Thanks for the nudge in the right direction!  ;-)

Now to figure out what's going on with "cpio".................




More information about the User mailing list