On Fri, Feb 24, 2012 at 1:53 PM, Sean P. DeNigris <sean@clipperadams.com> wrote:
I'm trying to pass a multiline argument, but none of the things that work in
the shell seem to work with OSP.

I passed both of the following to PipeableOSProcess>>waitForCommand: with a
"No such file or directory" error, which usually means that the multiline
part was not processed correctly. However, if I copy/paste them into the
shell, they work fine

heredoc:
'/usr/bin/osascript -ss  <<-EOF
tell application "Safari" to activate
tell application "Terminal" to activate
EOF'

double-quoted string:
'/usr/bin/osascript -ss  -e "
tell application \"Safari\" to activate
tell application \"Terminal\" to activate"'

Why are these not working?

OSP is not a shell.  Ask yourself what a program receives when iyt is invoked with the two examples above.  Then provide the equivalent argument to OSP and you'll find it'll work.  OSP is an interface to exec.  A shell is an interface to exec.  OSP doesn't parse arguments, just passes them onto exec.  A shell does parse arguments before passing them onto exec.  So the shell input

"
tell application \"Safari\" to activate
tell application \"Terminal\" to activate"

is a string argument which in Smalltalk would be written

(String with: Character lf), 'tell application "Safari" to activate', (String with: Character lf), 'tell application "Terminal" to activate'
 

HTH


Thanks.
Sean

--
View this message in context: http://forum.world.st/OSProcess-and-multiline-input-tp4418726p4418726.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.




--
best,
Eliot