Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Interactive shell (Real Studio getting started Mailinglist archive)

Back to the thread list
Previous thread: writing sideways workaround
Next thread: Realbasic and EDI (Electronic Data Interchange)


RB Database   -   tom.russell transport.alstom.com
  Interactive shell   -   Preston de Guise

Interactive shell
Date: 02.02.06 03:26 (Thu, 2 Feb 2006 13:26:13 +1100)
From: Preston de Guise
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>