Execute shell script command line with argument exceeding 256 chars
Hello everyone,
I have an issue with using "Open" function.
My goal is to execute a shell script with parameters like as:
/trak/FRXX/config/shells/transportIDE.sh "login|password|NOMUSUEL|PRENOM|NOMDENAISSANCE|1234567891320|199999999999999999999999|09%2099%2099%2099%2099|31%2F12%2F1999|242%20IMPASSE%20DES%20MACHINCHOOOOOOOOSE%20||99999|SAINT%20BIDULETRUC%20DE%20MACHINCHOSE|isc%24jhu|123456|123456798"" 2>&1"
But when some parameters are too long, I have a <NAMEADD> error.
I would like to avoid to write the %String command line in a temporary file and execute this file using : Open strCmd:"QR"
Is there a way to call a script with parameters using Open?
Thank you very much for your help.
Cheers
Jacques
Test script is:
ClassMethod TestScript() { #dim tSC as %Library.Status = $$$OK try { set (data,x) = "" set EOF = $zutil(68, 40) do $zutil(68, 40, 1) set strCmd = "/trak/FRXX/config/shells/transportIDE.sh ""login|password|NOMUSUEL|PRENOM|NOMDENAISSANCE|1234567891320|199999999999999999999999|09%2099%2099%2099%2099|31%2F12%2F1999|242%20IMPASSE%20DES%20MACHINCHOOOOOOOOSE%20||99999|SAINT%20BIDULETRUC%20DE%20MACHINCHOSE|isc%24jhu|123456|123456798"" 2>&1" open strCmd:"QR" for { use strCmd read x quit:$zeof=-1 use 0 write data, ! set data = data _ x } close strCmd do $zutil(68, 40, EOF) use 0 write data, ! } catch (SysEx) { set tSC = SysEx.AsStatus() } if $$$ISERR(tSC) { write $system.Status.GetErrorText(tSC) } quit }
Have you tried $zf(-100) instead?
This limit of 256 characters is a known problem with command pipes in Cache, and it seems that yet in IRIS. Agree with Dmitriy: $zf(-100) would be OK.
@Jack Huser ,
Instead of using a regular pipe, have you tried a Command Pipe ( |CPIPE| )?
Per this documentation: https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GIOD_interproccomm a CPIPE doesn't suffer from the 256(ish) character limit because the command called is the 2nd parameter.
Hope this helps!
Thank you very much to you all.
It helped a lot
Cheers