Jim Tcl
Check-in [010735d763]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:tests: Try to fix exec2-3.2 on Windows

On some mingw platforms exec2-3.2 isn't producing SIGPIPE Try to make it do so.

Signed-off-by: Steve Bennett <steveb@workware.net.au>

Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 010735d763194c5d9110e7668b568b0e535794b6
User & Date: steveb@workware.net.au 2017-10-16 21:51:09
Context
2017-10-21
02:37
file: __MSYS__ signifies windows too

Needed to make file join work with msys2

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 04d829652a user: steveb@workware.net.au tags: trunk

2017-10-16
21:51
tests: Try to fix exec2-3.2 on Windows

On some mingw platforms exec2-3.2 isn't producing SIGPIPE Try to make it do so.

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 010735d763 user: steveb@workware.net.au tags: trunk

21:39
signal, exec, wait, pid: improvements, especially to exec

- fix popen [open "|pipeline ..."] to return meaningful status in close (but note that stderr is not captured) - popen pipelines can now be used as the target of exec redirection - overally improvements to exec on windows. Now crt file descriptors are used throughout - add support for [pid], [wait] and popen on windows - os.wait is now wait, and integrates with [exec ... &] to be able to wait for running background tasks - [socket pipe] is now also [pipe] and is supported on windows - [file tempfile] is supported on windows - move duplicated code between jim-aio.c and jim-exec.c to jimiocompat.c - Fix [exec] on windows to match unix semantics wrt sharing the parent stream unless redirected rather than using /dev/null - On windows redirect to or from /dev/null is automatically converted to NUL: - If signal support is disabled, implement a minimal Jim_SignalId() for exec and wait - aio now supports getfd, to return the underlying file descriptor. This is used by exec to support redirection, and allows popen channels to support exec redirection.

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: da86539f12 user: steveb@workware.net.au tags: trunk

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/exec2.test.

48
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
	set f [open |false]
	set rc [catch {close $f} msg opts]
	lassign [dict get $opts -errorcode] status pid exitcode
	list $rc $msg $status $exitcode
} {1 {child process exited abnormally} CHILDSTATUS 1}

test exec2-3.2 "close pipeline return value" -body {
	set f [open "|echo abc | grep def | wc" ]

	set rc [catch {close $f} msg opts]
	lassign [dict get $opts -errorcode] status pid exitcode
	list $rc $msg $status $exitcode
} -match glob -result {1 {child killed*} CHILDKILLED SIGPIPE}


test exec2-3.4 "wait for background task" {
	set pid [exec sleep 0.1 &]
	lassign [wait $pid] status newpid exitcode
	if {$pid != $newpid} {
		error "Got wrong pid from wait"
	} else {
		list $status $exitcode
	}
} {CHILDSTATUS 0}


testreport







|
>




<













48
49
50
51
52
53
54
55
56
57
58
59
60

61
62
63
64
65
66
67
68
69
70
71
72
73
	set f [open |false]
	set rc [catch {close $f} msg opts]
	lassign [dict get $opts -errorcode] status pid exitcode
	list $rc $msg $status $exitcode
} {1 {child process exited abnormally} CHILDSTATUS 1}

test exec2-3.2 "close pipeline return value" -body {
	set bigstring [string repeat a 10000]
	set f [open [list |cat << $bigstring]]
	set rc [catch {close $f} msg opts]
	lassign [dict get $opts -errorcode] status pid exitcode
	list $rc $msg $status $exitcode
} -match glob -result {1 {child killed*} CHILDKILLED SIGPIPE}


test exec2-3.4 "wait for background task" {
	set pid [exec sleep 0.1 &]
	lassign [wait $pid] status newpid exitcode
	if {$pid != $newpid} {
		error "Got wrong pid from wait"
	} else {
		list $status $exitcode
	}
} {CHILDSTATUS 0}


testreport