When ever I run the cp command via runprogram using the following code it runs correctly, but only if i dont have any spaces in what i'm copying:
Code: Select all
from$=OpenFileRequester("Select file","","",1)
too$=PathRequester("choose dest", "")
from$=ReplaceString(from$," ","\ ")
too$=ReplaceString(too$," ","\ ")
run=RunProgram("cp","-v "+From$+" "+too$,"",#PB_Program_Open|#PB_Program_Read)
While ProgramRunning(run)
out$+ReadProgramString(run)+Chr(13)
Wend
CloseProgram(run)
OpenFile(1,"/Users/images/Desktop/Basic/output.txt")
WriteString(1,From$+" "+too$)
CloseFile(1)
MessageRequester("answer",Str(run)+" "+out$+": "+from$+" : "+too$,#PB_MessageRequester_Ok)
Now I'm converting spaces in the string with "\ ", and if I copy the command sent to cp using runprogram from my output.txt file to terminal it copies fine, so the syntax seem right.
Also if theres a space in the command line i get no response from #programoutput, If theres no space I get what i would expect to see in terminal....
Anyone know whats going on?