Shell - argv limits

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Shell - argv limits

Richmond Mathewson via use-livecode
When using argv it has a character limit.  I think it
might be different on different systems but you can
probably use a few thousand characters for each
argument.  You can have as many arguments as
memory can handle.  Probably thousands.  You
should refer to a file for larger data.

If you want to you can put a field in and argument.
Try changing the obj-c example to the following.
You need to use a global variable.


global pFILE1

on mouseUp
   set the defaultFolder to "~/desktop"
   put quote & fld <YOURFIELD1> & quote into pFILE1
   put quote & "My File.txt" & quote into tFILE2
   put shell( "./argv_string" && pFILE1 && tFILE2) into pData
   put pData into fld id <YOURFIELD2>
   beep 2
   put empty into pFILE1
end mouseUp

JB

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shell - argv limits

Richmond Mathewson via use-livecode
On 06/28/2017 04:06 PM, JB via use-livecode wrote:
> When using argv it has a character limit.  I think it
> might be different on different systems but you can
> probably use a few thousand characters for each
> argument.  You can have as many arguments as
> memory can handle.  Probably thousands.  You
> should refer to a file for larger data.

It does indeed depend on the OS, but I think the maximum length is for
the total command line, not for individual arguments. At any rate, for
my linux mint system I see an ARG_MAX value of 2097152.

https://stackoverflow.com/questions/6846263/maximum-length-of-command-line-argument-that-can-be-passed-to-sqlplus-from-lin

Note that there is also a limit to the number of arguments that can be
passed on a commandline, and as a rule of thumb it is *probably*
ARG_MAX/4-1, but if this is something that concerns you, you no doubt
have other things to worry about <g>.

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shell - argv limits

Richmond Mathewson via use-livecode
I am guessing the is a pretty large number.

JB


> On Jun 28, 2017, at 4:45 PM, Mark Wieder via use-livecode <[hidden email]> wrote:
>
> On 06/28/2017 04:06 PM, JB via use-livecode wrote:
>> When using argv it has a character limit.  I think it
>> might be different on different systems but you can
>> probably use a few thousand characters for each
>> argument.  You can have as many arguments as
>> memory can handle.  Probably thousands.  You
>> should refer to a file for larger data.
>
> It does indeed depend on the OS, but I think the maximum length is for the total command line, not for individual arguments. At any rate, for my linux mint system I see an ARG_MAX value of 2097152.
>
> https://stackoverflow.com/questions/6846263/maximum-length-of-command-line-argument-that-can-be-passed-to-sqlplus-from-lin
>
> Note that there is also a limit to the number of arguments that can be passed on a commandline, and as a rule of thumb it is *probably* ARG_MAX/4-1, but if this is something that concerns you, you no doubt have other things to worry about <g>.
>
> --
> Mark Wieder
> [hidden email]
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shell - argv limits

Richmond Mathewson via use-livecode
In reply to this post by Richmond Mathewson via use-livecode
JB wrote:

 > When using argv it has a character limit. I think it
 > might be different on different systems but you can
 > probably use a few thousand characters for each
 > argument.  You can have as many arguments as
 > memory can handle.  Probably thousands.  You
 > should refer to a file for larger data.

Have you looked into passing data with pipes (stdin/stdout)?

If the process will be long-running and used for multiple events,
sockets may be another option.

Reading up on how some folks pass data between processes on Linux
servers it seems the shared memory RAM disk automatically mounted at
/run/shm can be useful.  In some brief tests here it was about 9 times
faster than my fastest SSD, and a lot simpler than sockets.  In LC SHM
works great with normal file I/O commands.

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Shell - argv limits

Richmond Mathewson via use-livecode
No I have not but it is certainly
very interesting info.

Thank you,
JB


> On Jun 28, 2017, at 5:43 PM, Richard Gaskin via use-livecode <[hidden email]> wrote:
>
> JB wrote:
>
> > When using argv it has a character limit. I think it
> > might be different on different systems but you can
> > probably use a few thousand characters for each
> > argument.  You can have as many arguments as
> > memory can handle.  Probably thousands.  You
> > should refer to a file for larger data.
>
> Have you looked into passing data with pipes (stdin/stdout)?
>
> If the process will be long-running and used for multiple events, sockets may be another option.
>
> Reading up on how some folks pass data between processes on Linux servers it seems the shared memory RAM disk automatically mounted at /run/shm can be useful.  In some brief tests here it was about 9 times faster than my fastest SSD, and a lot simpler than sockets.  In LC SHM works great with normal file I/O commands.
>
> --
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> ____________________________________________________________________
> [hidden email]                http://www.FourthWorld.com
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Loading...