Looks like you ought to call popen for collecting outputs. > On Nov 26, 2017, at 11:51 PM, bill lam <[email protected]> wrote: > > In j805 2!:0 always failed for this both on linux and mac, On j806, > change had been made on the linux branch but not on mac. The code > starts from line 42 of > the file xh.c > https://github.com/jsoftware/jsource/blob/master/jsrc/xh.c > > note the command passed to 2!:0 is appended with redirection for a tmp > file which is used to collect result to report to J. > > 'cmd .... ' > tmpfile > if the cmd itself already contains an output redirection such as what > you did, then there will be 2 output redirections in the resultant > cmd, > 'bla bla > fork,6 > tmpfile' > perhaps the shell interpreter used in system() is not smart enough to > handle it. > > What is the expected standard behavior for it? Why hostcmd_j_ can > solve it? I dun know. > > > > 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
---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
