I think if you modify the code from 2!:0 'cmd .... <input >output' to one that just read result using J output fwrite~ 2!:0 'cmd ... <input' that might work even without hostcmd_j_
On Mon, Nov 27, 2017 at 1:07 PM, J. Patrick Harrington <[email protected]> wrote: > Many thanks. The expression > hostcmd_j_ =: [: 2!:0 '(' , ,&' || true)' solves the problem I had with > just 2!:0. But is there an explination > why an exprssion of the form 2!:0 'foo.exe <infile >outfile' should > work on some machines and fail on others, when both are running the > same version of J? I'm afraid my grasp of unix scripting is too poor > to understand just what hostcmd_j_ does. > > Patrick > > > On Sat, 25 Nov 2017, Joey K Tuttle wrote: >> >> Chris, >> Thanks for the credit - and I'm glad to see that hostcmd_j_ is commonly >> available. >> >> But, to be fair, I plagiarized the definition from Martin Neitzel more >> than 23 years ago... >> >> My servers invoke it many thousands of times a day in various monitoring >> scripts - and I use it often in CLI sessions as well. >> I like the fact that it always returns a result (as well as echoing stderr >> output to my CLI session), which desire is what Martin responded to all >> those years ago. >> >> - joey >> >> >>> On 2017Nov 25, at 12:14, chris burke <[email protected]> wrote: >>> >>> hostcmd_j_ is Joey's cover for 2!:0, e.g. see >>> www.jsoftware.com/pipermail/programming/2017-April/047204.html >>> >>> On Sat, Nov 25, 2017 at 12:06 PM, J. Patrick Harrington >>> <[email protected]> >>> wrote: >>> >>>> Sorry, I meant "returning with no screen output' >>>> I am now running the full program with hostcmd_j_ for 2!:0. >>>> It's chugging away, hasn't failed yet. :-) >>>> >>>> >>>> On Sat, 25 Nov 2017, J. Patrick Harrington wrote: >>>> >>>>> Chris, >>>>> >>>>> That test works. I just tried >>>>> >>>>> hostcmd_j_ '../synmod.exe < fort.5 >fort.6' >>>>> >>>>> and that works as well, returning with screen output, and writing >>>>> successfully to fort.6. So hostcmd_j_ ~: 2!:0 >> >> >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
