[android-porting] Re: How to call shell script from JNI?

2009-02-11 Thread frank.preel
Dianne, this one is for you ! On Feb 11, 1:54 pm, Corey wrote: > Currently I am trying to write an application in Android GUI. > One of the function will need to call one of the shell script in / > system/xbin/. > I write an API in C by using system("/system/xbin/test.sh"); funtion, > and then

[android-porting] Re: How to call shell script from JNI?

2009-02-11 Thread David Turner
you can't use system() to call a shell script, you need to invoke the shell interpreter instead, with something like "/system/xbin/sh /system/xbin/test.sh" On Wed, Feb 11, 2009 at 1:54 PM, Corey wrote: > > Currently I am trying to write an application in Android GUI. > One of the function will n

[android-porting] Re: How to call shell script from JNI?

2009-02-11 Thread fadden
On Feb 11, 8:13 am, David Turner wrote: > you can't use system() to call a shell script, you need to invoke the shell > interpreter instead, with something like "/system/xbin/sh > /system/xbin/test.sh" I tried it just now from a trivial C program; worked fine. I'm not sure why it would be diffe

[android-porting] Re: How to call shell script from JNI?

2009-02-11 Thread David Turner
On Wed, Feb 11, 2009 at 7:32 PM, fadden wrote: > > On Feb 11, 8:13 am, David Turner wrote: > > you can't use system() to call a shell script, you need to invoke the > shell > > interpreter instead, with something like "/system/xbin/sh > > /system/xbin/test.sh" > > I tried it just now from a triv

[android-porting] Re: How to call shell script from JNI?

2009-02-11 Thread David Turner
Actually, I retract that, after checking our implementation, it always do a "sh -c " so calling a shell script should work. Have you tried checking the return value and errno after the call ? On Wed, Feb 11, 2009 at 10:35 PM, David Turner wrote: > > > On Wed, Feb 11, 2009 at 7:32 PM, fadden wro

[android-porting] Re: How to call shell script from JNI?

2009-02-11 Thread Dan Bornstein
On Wed, Feb 11, 2009 at 4:54 AM, Corey wrote: > Currently I am trying to write an application in Android GUI. > One of the function will need to call one of the shell script in / > system/xbin/. > I write an API in C by using system("/system/xbin/test.sh"); funtion, > and then my Java code will u

[android-porting] Re: How to call shell script from JNI?

2009-02-12 Thread Dig
I also try to do something(a command, not a script) with system(), it always does not work. system() return value is 256(-1), according to ./bionic/libc/unistd/system.c is that means fork() error? On Feb 12, 9:52 am, Dan Bornstein wrote: > On Wed, Feb 11, 2009 at 4:54 AM, Corey wrote: > > Curr

[android-porting] Re: How to call shell script from JNI?

2009-02-12 Thread David Turner
-1 means you should look at errno / strerror(errno) for information about the error a >= 0 would correspond to the exit status of the process you invoked On Fri, Feb 13, 2009 at 1:43 AM, Dig wrote: > > I also try to do something(a command, not a script) with system(), it > always does not work.