args array in console app not split properly

I’m having a weird issue. I have a console application which I use as a helper. I run this helper app as an authenticated shell but other than that it should be normal.

If I run it by hand the args are split properly but when I run it from inside my main application the parameters are split differently.

Having this line (from the debugger, the exact same command sent to the console app):

./helper --dpath=/opt/local/sbin --cpath=/opt/local/etc/ --tpath=/opt/local/bin  --cmd=listUsers

I get this when run from the console:

[code]HELPER-ARGS: ./helper --dpath=/opt/local/sbin --cpath=/opt/local/etc/ --tpath=/opt/local/bin --cmd=listUsers
HELPER-ARG: ./helper (0)
HELPER-ARG: --dpath=/opt/local/sbin (1)
HELPER-ARG: --cpath=/opt/local/etc/ (2)
HELPER-ARG: --tpath=/opt/local/bin (3)
HELPER-ARG: --cmd=listUsers (4)
HELPER-NOTE: tpath is /opt/local/bin, cpath is /opt/local/etc/, dpath is/opt/local/sbin
HELPER-MAIN: listUsers
listUsers: tpath is /opt/local/bin, cpath is /opt/local/etc/
HELPER-EXEC:/opt/local/bin/useredit -L -s “/opt/local/etc/”/users.conf

eduo:501:Eduardo Gutierrez[/code]

But when I run it as a helper of my desktop app, as an authenticated shell, I get this:

app.debug[75251]: app: /Users/eduo/Builds/app.debug.app/Contents/Resources/app_wrapper/helper --dpath="/opt/local/sbin" --cpath="/opt/local/etc/" --tpath="/opt/local/bin" --cmd=listUsers --params=1 authexec[75319]: executing /Users/eduo/Builds/app.debug.app/Contents/Resources/app_wrapper/helper helper[75319]: HELPER-ARGS: /Users/eduo/Builds/app.debug.app/Contents/Resources/app_wrapper/helper --dpath=/opt/local/sbin --cpath=/opt/local/etc/ --tpath=/opt/local/bin --cmd=listUsers --params=1 helper[75319]: HELPER-ARG: /Users/eduo/Builds/app.debug.app/Contents/Resources/app_wrapper/helper (0) helper[75319]: HELPER-ARG: --dpath=/opt/local/sbin --cpath=/opt/local/etc/ --tpath=/opt/local/bin (1) helper[75319]: HELPER-ARG: --cmd=listUsers (2) helper[75319]: HELPER-ARG: --params=1 (3) helper[75319]: HELPER-NOTE: tpath is , cpath is , dpath is/opt/local/sbin --cpath helper[75319]: HELPER-MAIN: listUsers helper[75319]: listUsers: tpath is , cpath is helper[75319]: HELPER-EXEC:/useredit -L -s ""/users.conf

As you can see, the arguments are mangled in the second case, where three of them falling on the same one, and the last one separate.

Any ideas? I searched the old and new forums but either didn’t do it right or there’s no thread for it.

I think this a EndOfLine problem. Please try it with EndofLine.XX = (Mac, Unix or Windows). Or your should try " oder ’ for separating the args.

Hi

It can’t be an EOL issue since it’s a single line and there’re no EOLs except at the end. What’s being affected is at the beginning, so that doesn’t add up.

I tried with the quotes, but it didn’t work. I’m a bit desperate and even thinking of sending the parameters as a custom base64-encoded text just to avoid this problem with argument parsing.