On Fri, 09 Apr 2010, Pritpal Bedi wrote:

Hi,

> > At present (from the console output) it seems to be just:-
> > /home/baz/tmp/ahrl8i.sh && hbmk2 /home/baz/hash/ash.hbp -q -trace -info 
> > -lang=en
> 
> You are not taking into consideration <cCmd>.
> QProcess() expects two components, command and parameters.
> What you see are parameters, command is verified with <cCmd>
> as it shows up as - /bin/bash ( you confirmed in a prev post ).
> 
> > If I change to this
> >   cC   := iif( hbide_getOS() == "nix", "/bin/bash ", "/C " )
> >   then the console output looks correct, but still does not run:-

the standard parameter delimiter is '-'. '/' is MS "extensions" which
works only in DOS based systems. In all shells '-c <string>' can be
used to execute command specified in <string>. All other parameters
passed after <string> are parameters of executed command.

> Not invisibly. We are sending it as <cCmd>, <cArgs> where 
> cCmd == /bin/bash 
> cArgs == /home/baz/tmp/ahrl8i.sh && hbmk2 /home/baz/hash/ash.hbp -q -trace
> -info -lang=en

I guess that /home/baz/tmp/ahrl8i.sh contains some environment variables
settings. It will not work as you want for few reasons.
1. shell will try to execute above cArgs as single command and should show
   the message that such file does not exist. You should use "-c" switch
   before.
2. /home/baz/tmp/ahrl8i.sh does not have executable attribute so after
   fixing the problem in point 1 you will have message like:
   /home/baz/tmp/ahrl8i.sh: Permission denied
3. If you set executable attribute (point 2) then you exploit next problem.
   All environment variables set by /home/baz/tmp/ahrl8i.sh are local to
   /home/baz/tmp/ahrl8i.sh and are not visible for hbmk2 and its child
   processes. To resolve it you should not execute /home/baz/tmp/ahrl8i.sh
   as normal file but _include_ it to the current shell. Included files
   does not need executable attribute so you will not have to problem in
   point 2. To include file you can use "." command, i.e.:
      . /home/baz/tmp/ahrl8i.sh
   BTW the extension like .sh have no meaning in *nixes so you can ignore
   them.
   You can also remove "#!/bin/sh" from included files because "#" is
   used as comment (like REM in BATCH files).

In summary the final command should look like:

   cmd := 'sh -c ". /home/baz/tmp/ahrl8i.sh && hbmk2 /home/baz/hash/ash.hbp"'
   cmd += ' -q -trace -info -lang=en'
   HB_PROCESSRUN( cmd )

I do not know the QProcess parameters so I cannot tell you how exactly
it should look. Your comment above suggests that it should be enough
to make:
   cCmd := '/bin/sh'
   cArgs := '-c ". /home/baz/tmp/ahrl8i.sh && hbmk2 /home/baz/hash/ash.hbp"'
   cArgs += ' -q -trace -info -lang=en'

HTH,

best regards,
Przemek
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to