Ticket UUID: | 1267871 | |||
Title: | fully support win32 exit codes | |||
Type: | Patch | Version: | None | |
Submitter: | matt-newman | Created on: | 2005-08-24 10:08:00 | |
Subsystem: | None | Assigned To: | patthoyts | |
Priority: | 5 Medium | Severity: | ||
Status: | Closed | Last Modified: | 2005-11-05 06:06:45 | |
Resolution: | Accepted | Closed By: | patthoyts | |
Closed on: | 2005-11-04 23:06:45 | |||
Description: |
In the win32 world many people use exit codes greater than 8 bits. This patch preserves the Posix signal support in WaitPid on windows, but allows the true exit status to be reported. This kind of support is essential when calling many systems mgmt utilities from Microsoft and others..... | |||
User Comments: |
patthoyts added on 2005-11-05 05:57:35:
File Added - 155069: 1267871-exitcodes-85.patch patthoyts added on 2005-11-05 05:57:34: Logged In: YES user_id=202636 OK. Thank you. Applied the patch plus a few tests to 8.4 Up-ported to 8.5 HEAD too. (patch attached for the record). matt-newman added on 2005-11-04 19:15:56: Logged In: YES user_id=1333796 this patch is to allow exit codes greater that 255 - try: exit [expr { 1 << 15 }] It is about BOTH being able to exit with such a status, but far more importantly it is about being able to exec a process that returns such a return code and being able to obtain that return code. create exit.tcl as: exit [expr { 1 << 15 }] and execute: set rc [catch { exec [info nameof] exit.tcl } err] puts [list $rc $err $errorCode] with vanilla 8.4 you get 0 {} {} with the patched version you get: 1 {child process exited abnormally} {CHILDSTATUS 3152 32768} patthoyts added on 2005-11-04 18:58:52: Logged In: YES user_id=202636 OK - this patch doesn't seem to cause any problems but I don't see just what it achieves either. Using a script of 'exit [lindex $argv 0]' for various values shows no difference between 8.4.11 and the patched version. Likewise I see no obvious differences in the result of 'exec programreturningerrcodes' for various return values. I need a better description of just what is being achieved here before applying this so that we can add some tests. davygrvy added on 2005-11-04 04:53:19: Logged In: YES user_id=7549 Pat, I don't tools at this time.. please take over. thanks. patthoyts added on 2005-11-03 19:39:41: Logged In: YES user_id=202636 It might be useful to have a test that checks the behaviour of this patch. Applying this to the current 8.4 tip the test suite passes in normal, symbols and thread builds so it looks fine to me. matt-newman added on 2005-08-25 16:16:11: Logged In: YES user_id=1333796 WaitPid does not need changing, because the POSIX macros "do the right thing" - only code that makes assumptions about the status without reference to the macros would need changing, and there is no such code in tcl. The only limitation imposed on exit codes is that they can't set the top byte to match 0xc0 - which practically limits them to 24 bits. But as far as I can see that is a windows limit too. I was able to test both the large exit code and the SEGV- type senarios and all looks well... davygrvy added on 2005-08-25 12:28:16: Logged In: YES user_id=7549 interesting.. Doesn't Tcl_WaitPid need any modifying with this? hobbs added on 2005-08-25 02:05:20: Logged In: YES user_id=72656 Dave - you looked into this before, no? matt-newman added on 2005-08-24 17:08:02: File Added - 146791: patch1 |