Please help with a BufferedInputStream error on sh

giga

Well-Known Member
Licensed User
Longtime User
:)Help Please

B4X:
Dim prs As Phone
Dim out, err As StringBuilder
out.Initialize : err.Initialize
Dim text As String
prs.Shell("/data/data/my.app/files/rsync", Array As String(File.OpenInput(File.DirRootExternal & "/Rsync", "config.sh")), out, err) 
Log("out: " & out)
Log("err: " & err)

:BangHead:
log output
err: rsync: link_stat "/(BufferedInputStream) java.io.BufferedInputStream@41057760" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1039) [sender=3.0.6]

If i run this script through terminal I don't get any errors
BIG Thank you to everyone for their help.
 

giga

Well-Known Member
Licensed User
Longtime User
You should use File.ReadString instead of OpenInput.

:) Thanks Erel, ReadString is a better option. However doing this I get the (version info and the usage examples)for the rsync executable but it won't run the script.(config.sh)

In testing I have removed part of the script to see if it makes any difference no luck.

(it appears to not be able to run a .sh file) or I am doing something wrong. Any ideas are appreciated as always.
 
Upvote 0

giga

Well-Known Member
Licensed User
Longtime User
Sorry I'm not really familiar with rsync.

No Problem, Does the code look right for trying to run a script file though?

B4X:
Dim prs As Phone
Dim out, err As StringBuilder
out.Initialize : err.Initialize
Dim text As String
prs.Shell("/data/data/my.app/files/rsync", Array As String(File.ReadString(File.DirRootExternal & "/Rsync", "config.sh")), out, err) 
Log("out: " & out)
Log("err: " & err)

Should "sh" be the command because it is an .sh file?
Or "rsync" because that is the program I am sending .sh to.

I am confused now because I have tried it several different ways. :sign0188:.
 
Upvote 0

giga

Well-Known Member
Licensed User
Longtime User
Search for linux documentation about rsync. Does it know how to run SH files? I guess that it doesn't.

Thanks Erel for the reply. The same script will run thru terminal just not from the code. To my understanding it requires a shell (terminal) maybe that is the issue.

I will research further.
 
Upvote 0
Top