[Gambas-user] Standard Input & Exec
Tobias Boege
taboege at ...626...
Thu Feb 26 00:43:46 CET 2015
On Wed, 25 Feb 2015, John Rose wrote:
> I want an Exec command to take input from Standard Input. I've looked at
> the Gambas documentation and it states:
> "If WRITE is specified, data can be sent to the command standard input
> by using the Process object with common output instructions: PRINT,
> WRITE, ... Note that a reference to the Process object is required.".
>
> I don't understand the above. It seems to imply that I should code
> penigma_app.Print sPlain (with Dim sPlain As String and sPlain =
> "QWERTYU") where my Exec statement is:
> penigma_app = Exec aExecParameters Wait For Read Write As
> "EnigmaResultsDetail"
> and I have "Dim penigma_app as Process". However, the IDE does not show
> Print after coding penigma_app. and the compiler objects.
>
The documentation correctly says PRINT, WRITE, ... *instructions*. These are
keywords of the Gambas language, not methods of a class:
Dim hProc As Process
hProc = Exec ["prog", "arg"] For Read Write
Print #hProc, "input"
> What do I need to do. Also, the Gambas documentation states:
> "If you plan to control an application by sending commands to standard
> input then testing should be performed outside of the IDE (i.e. make an
> executable and launch it from the command line) as the console within
> the development environment is not a true virtual terminal and will
> cause unexpected results.".
> So presumably, I would need to test the app after creating an
> executable. So if the executable was named EnigmaWehrmacht.gambas what
> would I need to enter on the command line to test this app?
>
If your project directory is at /path/to/project, you do:
$ cd /path/to/project
$ gbc3 -ga # Re-compile the project
$ gbx3 # Execute the compiled files
This way does not require an executable .gambas archive. But you can also
try it with such an archive[*]:
$ cd /path/to/project
$ gba3 # Create project.gambas
$ gbr3 project.gambas # Run it
[*] And sometimes you want to test your project with an executable archive,
too, because certain ways of accessing project data files or something
may work when you run the project under the IDE and via the first way,
but not if you run from an executable archive. But this is entirely
different story.
Regards,
Tobi
--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
More information about the User
mailing list