Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2005-11-05
06:06 • Ticket [1267871fff] fully support win32 exit codes status still Closed with ... artifact: dea4b1a4e7 user: patthoyts
06:06 • Closed ticket [1267871fff]. artifact: 61b6edcab9 user: patthoyts
05:57 • Add attachment 1267871-exitcodes-85.patch to ticket [1267871fffffffff|1... artifact: 7303b4ad5d user: patthoyts
05:57 • Ticket [1267871fff] fully support win32 exit codes status still Open with 4 ... artifact: f35007bc9b user: patthoyts
05:57 • Ticket [1267871fff]: 5 changes artifact: 9a6ec4e808 user: patthoyts
2005-11-04
19:15 • Ticket [1267871fff]: 4 changes artifact: 1bacd2b0ea user: matt-newman
18:58 • Ticket [1267871fff]: 4 changes artifact: c99291d3d9 user: patthoyts
04:53 • Ticket [1267871fff]: 5 changes artifact: 8a96bfbf00 user: davygrvy
2005-11-03
19:39 • Ticket [1267871fff]: 4 changes artifact: 1db4bde496 user: patthoyts
2005-08-25
16:16 • Ticket [1267871fff]: 4 changes artifact: 32cd4bd69d user: matt-newman
12:28 • Ticket [1267871fff]: 4 changes artifact: ab5f625dd3 user: davygrvy
02:05 • Ticket [1267871fff]: 5 changes artifact: e50502560b user: hobbs
2005-08-24
17:08 • Ticket [1267871fff]: 4 changes artifact: 124268b3c4 user: matt-newman
17:08 • Add attachment patch1 to ticket [1267871fff] artifact: 8d6b7b1e8b user: matt-newman
10:08 • New ticket [1267871fff] fully support win32 exit codes. artifact: 10f51d388c user: matt-newman

fully support win32 exit codes

Closed / Accepted1267871fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2005-08-24 10:08:00
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.....
matt-newmanplain2005-08-24 17:08:02
File Added - 146791: patch1
hobbsplain2005-08-25 02:05:20
Logged In: YES 
user_id=72656

Dave - you looked into this before, no?
davygrvyplain2005-08-25 12:28:16
Logged In: YES 
user_id=7549

interesting..

Doesn't Tcl_WaitPid need any modifying with this?
matt-newmanplain2005-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...
patthoytsplain2005-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.
davygrvyplain2005-11-04 04:53:19
Logged In: YES 
user_id=7549

Pat, I don't tools at this time..  please take over. thanks.
patthoytsplain2005-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.
matt-newmanplain2005-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}
patthoytsplain2005-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).
patthoytsplain2005-11-05 05:57:35
File Added - 155069: 1267871-exitcodes-85.patch
patthoyts Closed ticket [1267871fff]. [History diff]2005-11-05 06:06:44
patthoyts Ticket [1267871fff]: 2 changes [History diff]2005-11-05 06:06:45
Log in (anonymous is fine) to add a comment.

Attachments: