createprocess issues on linux

BlitzMax Forums/BlitzMax Programming/createprocess issues on linux

peltazoid(Posted 2009) [#1]
Hi, I am having difficulty in starting up maxide-ce complied from source on ubuntu 8.10. It is compiled from the standard ide which works fine. when I try to launch the ide I get a can not check the version of blitzmax and to reinstall.

after checking the source of both the ce and the standard ide the version checking code seems the same.

I think the problem lies with the pub.freeprocess module, which after checking the source code, I could be very wrong but isn't the linux code for launching the process missing.

This snippet comes from the freeprocess module from my install. this was from the last SVN

Function Create:TProcess(name$,flags)
		Local	p:TProcess
		Local	infd,outfd,errfd	
?MacOS
		If FileType(name)=2
			Local a$=StripExt(StripDir(name))
			name:+"/Contents/MacOS/"+a$
		EndIf
?
		p=New TProcess
		p.name=name
?macos
		p.handle=fdProcess(bbStringToUTF8String(p.name),Varptr infd,Varptr outfd,Varptr errfd,flags)
?win32
		p.handle=fdProcess(p.name,Varptr infd,Varptr outfd,Varptr errfd,flags)
?
		If Not p.handle Return Null
		p.pipe=TPipeStream.Create(infd,outfd)
		p.err=TPipeStream.Create(errfd,0)
		If Not ProcessList ProcessList=New TList
		ProcessList.AddLast p
		Return p
	End Function
	
	Function TerminateAll() NoDebug
		Local	p:TProcess
		If ProcessList
			For p=EachIn ProcessList
				p.Terminate
				p.Close
			Next
		EndIf
	End Function



I wrote this test program to try and see what was going wrong, this is when I realised there could be an issue with createprocess.

Import pub.freeprocess

cmd$ = BlitzMaxPath$() + "/bin/bcc"
DebugStop
Local f : TStream = ReadFile(cmd$)
If f
	Print "file opened, now closing"
	CloseFile(f)
	Print "file closed, starting process"
	Local p : TProcess = createprocess(cmd$)
	If p
		Print p.status()
	End If
End If


as the readfile opens the file fine. and closes it ok as well.
tracing from createprocess it gets to

If Not p.handle Return Null


then exits as p.handle is null as there is only mac and windows fdProcess commands. nothing for linux. I take it this is not correct and there should be a similar line for linux systems?

Any help would be appricated.


nawi(Posted 2009) [#2]
Well, you could try to make a linux case since it is only one line of code and then try if it works..


peltazoid(Posted 2009) [#3]
I had thought about that, but I thought the params were different when they are not. Fuzzy head moment, lol.

I'm giving that a try, using the MacOS line.


peltazoid(Posted 2009) [#4]
Adding

?linux
p.handle=fdProcess(bbStringToUTF8String(p.name),Varptr infd,Varptr outfd,Varptr errfd,flags)


seemed to work.

has anyone else had this issue? is it present in 1.30? or just the dev version?

cheers.