Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-12

TProcess oddity?

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bart

Hi,

Just played with TProcess for the first time.
I observed some oddities (?, or maybe I'm just dumb ...).

If you try to execute a process that is non-executable (like for example a word doc), then on Windows an exception is raised and GetLastOSError returns 193.

If you try this on (my) linux, no exception is raised and a non-functional childprocess is forked (you can see it with ps ax). If you do this in a GTK 1 app, however, then the app gets killed. No errormessage, it just disappears.
On the console you can se some errormessage:
Xlib: unexpected async reply (sequence 0x4cf)

In GTK 2 app, there is no crash.

So 2 questions:

1. shouldn't trying to execute a non-executable file raise some kind of exception (like it does in Windows?
2. Why does the GTK 1 app crash? This might be a GTK bug and not fpc related.

As a way to work arond this (and at least preventing the crash): is there a reliable way of cheking tha a file can be executed in the first place? I know I can check for the execute permission of the file in question, but that is not enough (on my system any file copied from my windows partition to linux will have the x permission set).

Bart

Reply by email

Felipe Monteiro de Carvalho
to Bart

I think you should ask in one of the Free Pascal mailling lists, because this is a problem with the Free Pascal RTL which only FPC developers could fix.

Felipe Monteiro de Carvalho

Reply by email