Jason: I actually see a window very briefly appear when I invoke the mount/umount in Xfe. The spawned mount or umount command actually works, but Xfe still seems to get hung after popen(" ... mount ...") is called.
perthie: The "pop-under" window behavior may not be helpful (and maybe something that can be improved in flwm), but I don't see anything in the current Xfe code that would get messed up by window stacking order.
The File::mount member function has the following code:
...
// Perform the mount/unmount command
FILE *pcmd=popen(cmd.text(),"r");
if(!pcmd)
{
MessageBox::error(this,BOX_OK,_("Error"),_("Failed command: %s"),cmd.text());
return -1;
}
// Get error message if any
char text[10000]={0};
FXString buf;
while(fgets(text,sizeof(text),pcmd))
buf+=text;
snprintf(text,sizeof(text)-1,"%s",buf.text());
// Close the stream
if(pclose(pcmd))
{
MessageBox::error(this,BOX_OK,_("Error"),"%s",text);
return -1;
}
// Hide progress dialog
hide();
// Success message, eventually
if(mount_messages)
{
if (op==MOUNT)
MessageBox::information(this,BOX_OK,_("Success"),
_("Folder %s was successfully mounted."),dir.text());
else
MessageBox::information(this,BOX_OK,_("Success"),
_("Folder %s was successfully unmounted."),dir.text());
}
return 1;
We know the popen is doing what it is intended to do. We also know the wait cursor is not changing after invoking the command. Right after this code returns, the wait cursor should be cleared, and if there was an error, an error box would be displayed. So the only thing in the code I see that could possibly cause a hang is the while loop, which collects any output from the spawned mount/umount command. I think for end-of-file condition, fgets( ) may return the address of the buffer passed to it, while on a true error, it returns null. It might be a worthwhile test to compile it with the following while condition:
while(fgets(text,sizeof(text),pcmd) && strlen(text) > 0)
Alternatively, the command string that contains "mount " could be changed to "mount -v " so that some text will come back on the file handle opened with popen( ).
If it is not the while loop, I guess I don't understand the code enough to say yet what is going on.
--
Mike L.