First let me say: I have just a very little Mac OS X experience, but some Linux experience. Using bash is ok for me.
My father in law has an iMac with Mac OS 10.7 Lion. There seems to be a strange little bug, which prevents the "recycle bin" from being emptied. Apple has a workaround on their homepage that says one should open up a terminal, type "chflags -R nouchg " (<- with a space at the end of the line) and drop all the files from the recycle bin to the terminal.app.
Then press enter. AFAIK some kind of permissions get altered and then the recycle bin can be emptied as usually. No problem for me so far. But my father in law is not the kind of person that fires up a terminal and types commands...
So I tought, I'll write a little tool for him.
Just a window with an area, where he can drop the files on, a list where the files are listed and a button to execute that certain command.
The machine we're talking about has no development tools installed, no XCode and no PB. But I have the chance to do development on a 10.6 machine with PB 4.61 beta 1.
Now I played a little with the "Process" library and "RunProgram" (and such), but honestly: I'm not sure what's it all about.
For testing I altered the following code from the help/examples a little, but the output seems strange to me, I get no program data, just a 1 as exit code!
chf = RunProgram("chflags", "-R nouchg", "", #PB_Program_Open|#PB_Program_Read)
Output$ = ""
Output$ + ReadProgramString(chf) + Chr(13)
Output$ + Chr(13) + Chr(13)
Output$ + "Exitcode: " + Str(ProgramExitCode(chf))
Output$ = "Could not start the program"
There is no program output. If I run the same command (chflags -R nouchg) in terminal.app directly I get a least a small hint about the options.
So my question is: how can I dertemine if the program works and what output it has? Normally, if everything works well, there should be no output at all on a *nix box at all and the exit code should be 0.
Any idea and help is apreciated, thanks!