Thanks, Devon. I’ll give it a spin Mike
Sent from my iPad > On 13 Dec 2019, at 17:32, Devon McCormick <[email protected]> wrote: > > Hi - I get different behavior than this running "shell" from a J-console > session running under emacs: control returns to the J session after the > spreadsheet starts up. This is under Windows, which you appear to be > running. Also, I get the same behavior under JQt. > > However, I have seen the behavior you're reporting when I invoke a .bat > file. For this reason, I wrote a little C module, called "createProcess", > to spin off a process and return. > > The code for that follows, if you are interested. > > Regards, > > Devon > --- > //* createProcess.cpp: create a process and return. > > #include "stdafx.h" > #include "windows.h" > #include "shellapi.h" > #include <iostream> // cerr, endl, flush > #include <stdlib.h> // exit() > > using namespace std; > > #define BUFSZ 2048 > > int _tmain(int argc, wchar_t* argv[]) > { > SHELLEXECUTEINFO shExecInfo; > shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); > shExecInfo.fMask = NULL; > shExecInfo.hwnd = NULL; > shExecInfo.lpVerb = L"runas"; > > wchar_t args[BUFSZ]; args[0] = L'\0'; > if (argc > 1) > { shExecInfo.lpFile = argv[1]; > if (argc > 2) wcscpy_s(args, BUFSZ, argv[2]); > for (int ii = 3; ii < argc; ii++) > { wcscat_s(args, BUFSZ, L" \0"); wcscat_s(args, BUFSZ, argv[ii]); > } > args[wcslen(args)] = L'\0'; > } else > { shExecInfo.lpFile = L"foo"; > } > shExecInfo.lpParameters = args; > shExecInfo.lpDirectory = NULL; > shExecInfo.nShow = SW_NORMAL; > shExecInfo.hInstApp = NULL; > > ShellExecuteEx(&shExecInfo); > //WaitForSingleObject(ShExecInfo.hProcess,INFINITE); > return 0; > } > > On Fri, Dec 13, 2019 at 8:56 AM 'Mike Day' via Programming < > [email protected]> wrote: > >> I've just tried firing up a spreadsheet from J, and appear to find that >> J has to wait for >> the spreadsheet to be closed before the JQT terminal session can proceed. >> >> Specifically, if I enter the following from the terminal: >> shell_jtask_ 'c:/d/j901/user/temp/test1.ods' NB. Open Office >> document >> >> the cursor hangs at that line until I close the spreadsheet cleanly or >> messily using >> taskmaster. >> >> Odd perhaps, as shell is a cover for spawn: >> ''&$: :(spawn ('cmd /c ' , ])) >> >> >> and MSDOS help tells me that cmd/c terminates: >> >> " >> >> C:\Windows\System32>cmd/? >> Starts a new instance of the Windows command interpreter >> >> CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF] >> [[/S] [/C | /K] string] >> >> /C Carries out the command specified by string and then terminates >> >> " >> >> >> Not too important for me - just puzzling. >> >> >> Thanks, >> >> >> Mike >> >> >> >> >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > > > -- > > Devon McCormick, CFA > > Quantitative Consultant > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
