You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Quote CL cmd in iCmd5250 for shell escaping (#50)
iCmd5250 is just a fancy wrapper around iSh, using the PASE system
command. It did not do any shell escaping/quoting, so it basically only
allowed calling CL commands without parameters or with only positional
parameters because the parentheses would cause the shell to gack.
eg.
iCmd5250('wrkactjob', 'WRKACTJOB SBS(QBATCH)')
basically became
iSh('wrkactjob', '/QOpenSys/usr/bin/system WRKACTJOB SBS(QBATCH)')
When executed, an error would be given from the shell:
sh: syntax error at line 1 : `(' unexpected
The proper fix is to quote the string, but that can be tricky to get
right. Luckily, Python has shlex.quote to do the hard work for us.
https://docs.python.org/3/library/shlex.html#shlex.quote
For Python 2, we have to add our own shlex.quote equivalent.
Fixes#49
0 commit comments