Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch main-tip424 Excluding Merge-Ins
This is equivalent to a diff from 7c4e907b46 to be45bbdde0
|
2024-08-11
| ||
| 17:24 | Fix bug [fccb9f322f] - system encoding detection check-in: 17c53b7edd user: apnadkarni tags: trunk, main | |
| 06:53 | main with tip-424 branch "tip-improve-exec" merged in. Leaf check-in: be45bbdde0 user: pooryorick tags: main-tip424 | |
|
2024-08-09
| ||
| 15:14 | Merge-mark check-in: 7c4e907b46 user: jan.nijtmans tags: trunk, main | |
| 15:12 | Make realclean/hose target consistent with clean with respect to pkgs cleanup check-in: 11066a7726 user: jan.nijtmans tags: core-8-branch | |
| 13:02 | Fix for [201c7a3aa6] - crash with non-BMP chars when encodingto stateful encodings check-in: f25a8e1ef2 user: apnadkarni tags: trunk, main | |
|
2013-07-07
| ||
| 15:43 | First part of upcoming TIP - Improving [exec]'s syntax : the syntax extension (not the new redirects... Leaf check-in: ca7271f40f user: ferrieux tags: tip-improve-exec | |
Changes to generic/tclPipe.c.
| ︙ | |||
462 463 464 465 466 467 468 469 470 471 472 473 474 475 | 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | + + + |
const char *nextArg;
int skip, atOK, flags, needCmd, errorToOutput = 0;
Tcl_Size i, j, lastArg, lastBar;
Tcl_DString execBuffer;
TclFile pipeIn;
TclFile curInFile, curOutFile, curErrFile;
Tcl_Channel channel;
int newSyntax = 0;
Tcl_Size subArgc;
const char **subArgv = NULL;
if (inPipePtr != NULL) {
*inPipePtr = NULL;
}
if (outPipePtr != NULL) {
*outPipePtr = NULL;
}
|
| ︙ | |||
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | + + + + + + + + + |
* list.
*/
lastBar = -1;
cmdCount = 1;
needCmd = 1;
for (i = 0; i < argc; i++) {
if (newSyntax && needCmd) {
needCmd = 0;
continue;
}
errorToOutput = 0;
skip = 0;
p = argv[i];
switch (*p++) {
case '|':
if ((i == 0) && (*p == '\0')) {
newSyntax = 1;
lastBar = 0;
continue;
}
if (*p == '&') {
p++;
}
if (*p == '\0') {
if ((i == (lastBar + 1)) || (i == (argc - 1))) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"illegal use of | or |& in command", -1));
|
| ︙ | |||
673 674 675 676 677 678 679 | 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | + + + + + + + + + + + - - - - - + + + + + + |
if (errorFile == NULL) {
goto error;
}
}
break;
default:
if (newSyntax) {
Tcl_SetObjResult(interp,
Tcl_ObjPrintf(
"Unsupported redirection \"%s\"",
argv[i]));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC",
"PIPESYNTAX", NULL);
goto error;
} else {
|
| ︙ | |||
824 825 826 827 828 829 830 831 832 833 834 835 836 | 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 | + + + + + + + + + + + + + + - - - - - - + + + + + + + |
* arguments between the "|" characters.
*/
Tcl_ReapDetachedProcs();
pidPtr = (Tcl_Pid *)Tcl_Alloc(cmdCount * sizeof(Tcl_Pid));
curInFile = inputFile;
lastArg = argc; /* compiler warning */
for (i = 0; i < argc; i = lastArg + 1) {
int result, joinThisError;
Tcl_Pid pid;
const char *oldName;
if (newSyntax) {
if (i == 0) {
lastArg = i;
continue;
}
if (Tcl_SplitList(interp, argv[i], &subArgc, &subArgv) != TCL_OK) {
goto error;
}
if (Tcl_TranslateFileName(interp, subArgv[0], &execBuffer) == NULL) {
goto error;
}
} else {
|
| ︙ | |||
879 880 881 882 883 884 885 | 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 | + + + + + + + - - - - - - - - - - + + + + + + + + + + + |
if (joinThisError != 0) {
curErrFile = curOutFile;
} else {
curErrFile = errorFile;
}
if (newSyntax) {
subArgv[0] = Tcl_DStringValue(&execBuffer);
result = TclpCreateProcess(interp, subArgc, subArgv,
curInFile, curOutFile, curErrFile, &pid);
Tcl_Free(subArgv);
subArgv = NULL;
} else {
|
| ︙ | |||
976 977 978 979 980 981 982 983 984 985 986 987 988 989 | 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 | + + + + |
if (pidPtr != NULL) {
for (i = 0; i < numPids; i++) {
if (pidPtr[i] != (Tcl_Pid)-1) {
Tcl_DetachPids(1, &pidPtr[i]);
}
}
Tcl_Free(pidPtr);
}
if (subArgv != NULL) {
Tcl_Free(subArgv);
subArgv = NULL;
}
numPids = -1;
goto cleanup;
}
/*
*----------------------------------------------------------------------
|
| ︙ |
Changes to tests/exec.test.
| ︙ | |||
373 374 375 376 377 378 379 | 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | - + |
# Errors in executing the Tcl command, as opposed to errors in the processes
# that are invoked.
test exec-10.1 {errors in exec invocation} -constraints {exec} -body {
exec
} -returnCodes error -result {wrong # args: should be "exec ?-option ...? arg ?arg ...?"}
test exec-10.2 {errors in exec invocation} -constraints {exec} -body {
|
| ︙ | |||
737 738 739 740 741 742 743 744 745 746 747 748 749 750 | 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 | + + + + + + |
} -cleanup {
removeFile $path(script)
encoding system $enc
} -body {
list [catch {exec [info nameofexecutable] $path(script)} r] $r
} -result [list 1 a\uFFFDb]
# New Syntax
test exec-20.1 {New exec syntax with sublists} {exec} {
exec | {echo >}
} >
# ----------------------------------------------------------------------
# cleanup
foreach file {gorp.file gorp.file2 echo echo2 cat wc sh sh2 sleep exit err} {
removeFile $file
}
|
| ︙ |