First let me say: I have just a very little Mac OS X experience, but some Linux experience. Using bash is ok for me.
Situation:
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!
Code: Select all
chf = RunProgram("chflags", "-R nouchg", "", #PB_Program_Open|#PB_Program_Read)
Output$ = ""
If chf
While ProgramRunning(chf)
If AvailableProgramOutput(chf)
Output$ + ReadProgramString(chf) + Chr(13)
EndIf
Wend
Output$ + Chr(13) + Chr(13)
Output$ + "Exitcode: " + Str(ProgramExitCode(chf))
CloseProgram(chf)
Else
Output$ = "Could not start the program"
EndIf
MessageRequester("Output", Output$)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!

