summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--UCoreUtils.pas16
-rw-r--r--ULibc.pas2
-rw-r--r--libgtk_kylix/GTKForms.pas4
3 files changed, 17 insertions, 5 deletions
diff --git a/UCoreUtils.pas b/UCoreUtils.pas
index 8fa6fef..ed697d5 100644
--- a/UCoreUtils.pas
+++ b/UCoreUtils.pas
@@ -1129,6 +1129,7 @@ begin
end;
// Duplicate this process
+ DebugMsg(['SpawnProcess: before fork']);
child_pid := fork;
if child_pid <> 0 then begin
Result := child_pid;
@@ -1140,14 +1141,17 @@ begin
if args_list <> nil then libc_free(args_list);
Application.ProcessMessages;
Running := ChildExitStatus < 0;
+ DebugMsg(['SpawnProcess: ChildExitStatus = ', ChildExitStatus]);
if not Running then Result := 0;
if not WIFEXITED(ChildExitStatus) then Result := WTERMSIG(ChildExitStatus);
+ DebugMsg(['SpawnProcess: Result = ', Result]);
end else begin
// Now execute AppPath, searching for it in the path
execvp(PChar(AppPath), args_list);
// The execvp function returns only if an error occurs
sigqueue(getppid, SIGUSR1, sv);
- Halt(ConstERRSpawn);
+ DebugMsg(['SpawnProcess: forked: error, sending SIGUSR1']);
+ _exit(ConstERRSpawn);
end;
ChildExitStatus := -1;
end;
@@ -1241,7 +1245,11 @@ begin
if Length(Args) = 0 then Exit;
for x := 0 to Length(Args) - 1 do Args[x] := RemoveQuotation(Args[x]);
DebugMsg(['**** Running spawn']);
- x := SpawnProcess(Args[0], Running, Args);
+ try
+ x := SpawnProcess(Args[0], Running, Args);
+ except
+ on E: Exception do DebugMsg(['ExecuteProgram(AppCMDLine = ''', AppCMDLine, '''): Exception: ', E.Message]);
+ end;
DebugMsg(['**** Running spawn -- done']);
Result := Running;
if not Running then ErrorSignal := x;
@@ -1378,7 +1386,7 @@ begin
execvp(PChar(Parameters[0]), args_list);
DebugMsg(['***** HandleSystemCommand: failed execvp: something went wrong...']);
WriteLn(erroutput, 'Error executing command');
- Halt(ConstERRSpawn);
+ _exit(ConstERRSpawn);
end;
Result := Length(s) = 0;
@@ -1929,7 +1937,7 @@ begin
memset(@sigchld_action, 0, SizeOf(__sigaction));
sigchld_action.__sigaction_handler := @signal_proc;
sigaction(SIGUSR1, @sigchld_action, nil);
- sigaction(SIGCHLD, @sigchld_action, nil);
+ sigaction(SIGCHLD, @sigchld_action, nil);
end;
procedure SetupColors;
diff --git a/ULibc.pas b/ULibc.pas
index 585b7c8..ba60e47 100644
--- a/ULibc.pas
+++ b/ULibc.pas
@@ -790,6 +790,8 @@ function WCOREDUMP(Status: longint): Boolean;
function W_EXITCODE(ReturnCode, Signal: longint): longint;
function W_STOPCODE(Signal: longint): longint;
+procedure _exit(status: longint); cdecl; external GLIBC_LIB name '_exit';
+
function gethostname(name: PChar; len: size_t): Longint; cdecl; external GLIBC_LIB name 'gethostname';
function sigqueue(pid: __pid_t; sig: Longint; val: sigval): Longint; cdecl; external GLIBC_LIB name 'sigqueue';
diff --git a/libgtk_kylix/GTKForms.pas b/libgtk_kylix/GTKForms.pas
index ad755b7..db6b445 100644
--- a/libgtk_kylix/GTKForms.pas
+++ b/libgtk_kylix/GTKForms.pas
@@ -675,6 +675,8 @@ begin
CheckSynchronize; }
end;
+procedure _exit(status: longint); cdecl; external 'libc.so.6' name '_exit';
+
procedure TGTKApplication.Run;
begin
repeat
@@ -686,7 +688,7 @@ begin
on E : Exception do
if E is EControlC then begin
WriteLn('*** Exception: ', E.Message);
- Halt(1);
+ _exit(1);
Exit;
end else HandleException(E);
end;