[R-SIG-Mac] system command in OS X failed when ampersand was added to command

Simon Urbanek simon.urbanek at r-project.org
Sun Mar 6 21:41:40 CET 2011


On Mar 6, 2011, at 11:12 AM, Noah Lorang wrote:

> I'm not able to replicate using the same setup on several computers, either with R.app or R running in the terminal, so it's likely something highly specific to your setup. I'd suggest reinstalling or upgrading R and see if the problem goes away.
> 
> The clearer way to do this in R, in my opinion, is to use the wait=FALSE flag in system(), which has the same effect as & directly in the shell.
> 

FWIW open returns immediately so both wait=FALSE and & are pointless -- they only prevent you from checking the result (and FWIW -a is an override that is not necessary unless you want to force a binding different from the OS type registration).

Also you said "the command failed" but what exactly does that mean?

Cheers,
Simon


> Noah
> 
> On Mar 6, 2011, at Mar 6 10:29 AM , Dennis Fisher wrote:
> 
>> Colleagues
>> 
>> I just encountered an odd problem with the system command; perhaps someone can provide some insight.
>> At some point in the past (~ 6 months ago; I was using the latest version of R and Snow Leopard available at the time), the command:
>> 	system("open -a /complete/path/to/app /complete/path/to/file &")
>> ran successfully.  
>> 
>> I am using R 2.12.0 and OS X.6.6 and the command failed.  To my surprise, removed the ampersand fixed the problem.  I don't know if the problem lies with OS X or R's interaction with OS X.  Does anyone have any insights into this?
>> 
>> Dennis
>> 
>> 
>> Dennis Fisher MD
>> P < (The "P Less Than" Company)
>> Phone: 1-866-PLessThan (1-866-753-7784)
>> Fax: 1-866-PLessThan (1-866-753-7784)
>> www.PLessThan.com
>> 
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 
> 



More information about the R-SIG-Mac mailing list