odd issue while using scala.sys.process

107 views
Skip to first unread message

Arun Ramakrishnan

unread,
May 25, 2012, 10:25:19 PM5/25/12
to scala...@googlegroups.com
import scala.sys.process._ 
"scalac *.scala" ! 

results in 

error: source file '*.scala' could not be found
one error found


Not sure, why it wont interpret the unix wild cards. Am wondering if this is a mac specific text encoding related issue. 


this is with 
scala 2.9.2
OS X 10.7

thanks
Arun

 

Daniel Sobral

unread,
May 25, 2012, 10:38:59 PM5/25/12
to Arun Ramakrishnan, scala...@googlegroups.com
It is shell who expands wildcards. You are calling "scalac" directly
instead of going through a shell, so no expansion happens.
--
Daniel C. Sobral

I travel to the future all the time.

Arun Ramakrishnan

unread,
May 28, 2012, 5:23:32 PM5/28/12
to Daniel Sobral, scala...@googlegroups.com
Thanks for the pointer. But, am not sure how to get around it

On bash or shell, the following works just fine
$bash -c "ls *.scala"

But,

""""bash -c "ls *.scala""""
Still dosent work.

thanks

Daniel Sobral

unread,
May 28, 2012, 5:44:44 PM5/28/12
to Arun Ramakrishnan, scala...@googlegroups.com
On Mon, May 28, 2012 at 6:23 PM, Arun Ramakrishnan
<sinchron...@gmail.com> wrote:
> Thanks for the pointer. But, am not sure how to get around it
>
> On bash or shell, the following works just fine
>>>
>>> $bash -c "ls *.scala"
>
>
> But,
>
>> """"bash -c "ls *.scala""""
>
> Still dosent work.

Because the quotes are not delimiting the parameter passed to bash --
it is Scala who decides how the arguments break up, and it simply
splits on spaces, without any quotation facility. If you try the
following, instead, it will work:

Seq("bash", "-c", "ls *.scala").!

Arun Ramakrishnan

unread,
Jun 1, 2012, 3:08:14 AM6/1/12
to Daniel Sobral, scala...@googlegroups.com
Thanks Daniel.
Reply all
Reply to author
Forward
0 new messages