[Gambas-user] Strange problem with running Shell on Fedora (code works in IDE but not in executable!!)
Willy Raets
willy at ...2734...
Wed Mar 27 16:50:17 CET 2013
I have this strange problem on Fedora.
I have this form (part of a bigger project) that is used to install rpm
packages on Fedora using yum.
The form has:
txbPass (TextBox) to enter password
tarOutput (TextArea) to output stream read from the running yum in shell
btnInstall (Button) to click to start installing
variable PathTemp (String) contains full path to rpm install file
The code for btnInstall is:
Public Sub btnInstall_Click()
Dim sPass, sEPass, sCommand, sFull As String
btnClose.Enabled = False
tarOutput.Clear
Me.Refresh
Wait 0.15
If tbxPass.Text = Null Then
Message.Warning("First enter a password")
btnClose.Enabled = True
tbxPass.SetFocus
Else
sPass = tbxPass.Text
sEPass = "echo \"" & sPass & "\" | "
sCommand = "yum install -y " & PathTemp
sFull = sEPass & "sudo -S " & sCommand
'TODO: Remove print
Print sFull
tarOutput.Text = "Start install..\n\n"
Wait 0.05
hProcess1 = Shell sFull For Read As "Process1"
hProcess1.Wait
hProcess1.Kill
Wait 0.05
tarOutput.Text &= "\nEnd install.."
btnClose.Enabled = True
btnInstall.Enabled = False
btnClose.SetFocus
Endif
Catch
tarOutput.Text &= Error.Text
If hProcess1.State = 1 Then
hProcess1.Kill
Endif
Error.Clear
End
Public Sub Process1_Read()
Dim sLine As String
Read #hProcess1, sLine, Lof(hProcess1)
tarOutput.Text &= sLine
tarOutput.Refresh
Wait 0.02
End
What happens:
1. When running from IDE (debug -> run) the installation runs perfectly
and application installs.
tarOutput reads:
Start install..
<multiple lines of installation progress output by yum>
End install..
2. When running a gambas executable of the application or install a IDE
made package of the application the installation doesn't run for some
reason and rpm package doesn't install
tarOutput reads:
Start install..
End install..
So no output from the Process1_Read event is added, nor is application
installed. It seems as if shell is never run!!
Any ideas here?
[System]
OperatingSystem=Linux
Kernel=3.8.4-102.fc17.i686
Architecture=x86
Distribution=redhat Fedora release 17 (Beefy Miracle)
Desktop=LXDE
Theme=QWindows
Language=en_US.UTF-8
Memory=1003M
[Libraries]
GStreamer=libgstreamer-0.10.so.0.30.0
GTK+=libgtk-x11-2.0.so.0.2400.13
Poppler=libpoppler.so.19.0.0
Qt4=libQtCore.so.4.8.4
SDL=libSDL-1.2.so.0.11.3
Gambas 3.4.0
--
Kind regards,
Willy (aka gbWilly)
http://gambasshowcase.org/
http://howtogambas.org
http://gambos.org
More information about the User
mailing list