HB_ProcessOpen( <cCommand>, [ @<cStdIn>, @<cStdOut>, @<cStdErr>, <lDetach>, @<nProcId> ] ) -> <hProcess> |
HB_ProcessValue( <hProcess>, <lWait> ) -> <nResult> |
HB_ProcessClose( <hPorcess>, <lGentle> ) -> <lResult> |
HB_ProcessRun( <cCommand>, [ <cStdIn> ], [ @<cStdOut> ], [ @<cStdErr> ], [ <lDetach> ] ) -> <nResult> |
HB_ProcessOpen(
cCommand [, @hStdIn, @hStdOut, @hStdErr, lDetach, @nProcId ] ) -> hProcess (hStdIn, hStdOut and hStdErr will store HANDLES) |
HB_ProcessValue( hProcess, lWait ) -> nResult |
HB_ProcessClose( hProcess, lGentle ) -> lResult |
HB_ProcessRun(
cCommand [, cStdIn, @cStdOut, @cStdErr, lDetach ] ) -> nResult (cStdIn, cStdOut, cStdErr will store string BUFFERS) Also you can take a look at hbmk2.prg in utils/hbmk2 folder, specially the hbmk_hb_processRunCatch() function wich uses the functions you ask for. Regards, -- Juan Luis |
Hello.This is an proof of concept of using an interface to communicate with a Java application using JSON.
(hbmk2.prg). I must admit that the diving into this abysmal source,
is an interesting experience suitable for people with strong nerves
and a heroic, although chaotic, sense of coding.
And then i thought that somebody here (in the group) might had
something more enlightening to offer.
Hello Viktor,
I admit that you're a great programmer (proven), genuinely devoted to
the open-source affair and particularly to Harbour-project , but if
you (mis)interpret the term "holy-beast" as "horrible shit" then you
know absolutely nothing about the so called "High Art" (and that's
disappointingly unacceptable for high-skilled programmers! or am I
doing an invalid remark, about high-skilled programmers?) ;-)
Now, if you want to know my feeling, while reading the sources of
hbmk2 (probably not, but i'll tell you): I could describe this great
program's source as the Colosseum of all the 'xbase' sources ever
written and shone, under the sun of the FOSS-planet, and also as the
Pantheon of all the hb_* functions, not to mention the immeasurable
population (almost like a beach's sand-grains) of all the 'LOCALs',
'DEFINEs' and giant 'ARRAYs elements'. Pretty much 16.750 lines
(blanks included), weighing not less than 675 KB (692.016 byte,
actually) of pure harbour code.
That's a miracle! but the real miracle is that this code works and
works very well.
Now you may not like my view, but wtf? those are my thoughts while I'm
reading this monolithic source.
I don't believe that you believe that "Any thought that occurs in the
process of reading this source is subject to authorization. [and that]
Unauthorized thinking of it is prohibited" to paraphrase a funny quote
i have found in the net. Do you?
That said, i would ask you to avoid making wrong assumptions that is
leading you to explosive replies, with no particular reason.
The "very simplistic and self-contained hbmk_hb_processRunCatch()
function", which i was able to read despite your rather offensive
comment, doesn't shed much light regarding the questions i have asked
in my first post, (which i don't know if took the trouble to read).
- the parent program waits until cCommand finish or not?
- if cCommand calls a second command/program the output of this second
command/program will be redirected/cached into StdOut/ErrOut vars?
- what is the purpose of HB_PROCESSVALUE(hProcess) , i mean, what it
returns (some error code or what?) and how it could exploited.
- HB_PROCESSCLOSE(hProcess) has to be invoked to terminate
hb_ProcessOpen() or the process is terminated when cCommand finishes?
Ok, i can do some guesses about f.e. the nExitCode but it partialy
only answers
one of my questions. And while a guess may be a first-hand aid, it
doesn't
mean that is a documented knowledge.
You probably know all the relevant answers, and you're not obliged to
share them,
but keep in mind that it could serve as documentation available to all
the
harbour comunity not as a "free docs" but as shared knowledge which is
a
fundamental principle of the FOSS culture.
Arbitrary points.
First, I didn't get your source code "for free".
You probably mean "free of money" but even so, I didn't get it "for
free".
Believe it or not, nothing is free in the net. Everything has its
cost, (moneys included). Now if it happens the one's (taker) cost to
not go
into the pocket of the other (giver) it's an other story
which needs much-much lines to exposed.
Second, I don't "continuously complain about lack of free docs"
(again the "free" argument).
From time to time, I do some queries to find documentation.
In the past the documentation affair, has been discussed,
with no positive results. You know why? I know. (I think..)
So better to stop here with a hope that you'll not get it wrong again
and think to hit me in the foot. ;-)
(some relax and a sense of humor is what we all need sometimes..)
> You should also understand that for me this whole development
> is a permanent and endless loop of personal hassles and negative
> feedback in response to huge work done in public. This, I'm still
> not used to and probably never will, and sometimes I do need to
> reflect.
> As for me, I'm happy he put these out there
> for us to explore further.
> You should also understand that for me this whole development
> is a permanent and endless loop of personal hassles and negative
> feedback in response to huge work done in public. This, I'm still
> not used to and probably never will, and sometimes I do need to
> reflect.The truth is that the harbour project, if it is still alive, it is thanks to your persistent devotion and continuous efforts especially in the last months where the "big guns" have disappeared from the field. I understand the pressure, what else i could say, other than that many harbour users are grateful for your support?
> As for me, I'm happy he put these out there> for us to explore further.
You may be happy but i am not so much. Let me explain why i 'm not that easy to share the joy. Two reasons:
1. While it is potentially useful, it demands a lot of laboring to become applicable and to bring in all the expected (and possibly big) benefit; but the most important is...
2. It boosts, unintentionally, one of the gray sides of the FOSS realm, which is no other than the ongoing tendency for insufficient documentation and/or lack of support. (one of the main arguments used against the spread and use of open sourced software)
Doing a great contribution of code (in whatever degree of quality and quantity it is this) without a basic documentation it's in some extend incomplete. And anybody saying that a basic documentation is essential, and looking for it, surely doesn't try to degrade the contribution but rather seeks to cure the incompleteness.
Now, I am already hearing the easy argument:
- Look, if you can't use it, then you don't use it. That simple!
- Is it that simple indeed?
- No!
- Why no?
- Well, if you can't get it, then.. you don't get it! ;-)
a : having immense or fathomless extension downward, backward, or inward <an abysmal cliff>
b : immeasurably great : profound <abysmal ignorance>
c : immeasurably low or wretched <abysmal living conditions of the poor>
2
: abyssal
------------------------------------------------------------------
I used the term in the meaning of the (a) definition,
but reading to the (b) and (c) i tend to think that the word can have a negative sense. Maybe I could use a less dangerous word but that's the problem with the non-natives broken-english; sometimes they are a "feature" sometimes "a bug". I suppose we can live with this. ;-)