Hi all,

Using RB2006 realease 1 on the Mac I'm want to build a GUI around a
command line backup & recover tool from a major enterprise backup
product which was ported to the Mac but sans GUI.

Since the recovery tool in that program is essentially an interactive
shell, I thought I'd start off with something simple, and setup a test
program consisting of:

- An input area
- An output area
- A "run" button.

When the "run" button is clicked, it should check to see whether the
global "MyShell" property (a Shell) class is running, and if it isn't,
Execute it, then pump the input to it and retrieve the results from
it. I need to keep the shell running between clicks of the "run"
button.

The documentation seems to suggest that on the Mac only, executing a
shell in interactive mode like this should actually work, but I find
that it (apparently) executes the shell, but as soon as it tries to
write the passed input to the shell I get a ShellNotRunningException.

The code for the action click of the run button is as follows:

  If MyShell <> Nil then
    if Not MyShell.IsRunning then
      MyShell.Mode = 1  // Turn on interractive mode; no effect if not used.
      MyShell.Execute("/bin/sh")
    end if
  else
    MyShell = new Shell
    MyShell.Mode = 1  // Turn on interractive mode; no effect if not used.
    MyShell.Execute("/bin/sh")
  end if

  Dim Command as String
  Command = CmdInput.Text

  if Command <> "" then
    // Not even adding the below stopped the exception, suggesting the
shell is immediately terminating.
    If Not MyShell.IsRunning then
      MyShell.Mode = 1
      MyShell.Execute("/bin/sh")
    end if
    MyShell.Write Command
    MyShell.Write Chr(13)
    CmdOut.Text = MyShell.ReadAll
  else
    MsgBox "You must specify a command to run!"
  end if


Has anyone done this, or know what I might be doing wrong as far as
invoking a shell and getting it to remain active? (RealBasic Standard,
BTW.)

Cheers,

Preston.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to