Age | Commit message (Collapse) | Author | Files | Lines |
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
|
|
It is necessary to read output from the pipe before waiting
for children to exit to avoid the output filling up and blocking.
The error results still needs to be read after the children have
exited, since it is read from a temp file, not a pipe.
Increase the length of the input to test exec-8.1 to catch
the problem.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Fix a race condition in [exec] where stdout and stderr are read
without waiting until all child processes have exited. This meant
that the following may capture no stderr output.
exec >@stdout command-with-stderr
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Consider the command pipeline:
exec a | b | c
Previously, if any of the subcommands terminated abnormally (with a signal),
the stdout of the pipeline would be lost.
Now the output consists of:
1. standard output from the last command in the pipeline
2. standard error from all commands in the pipeline
3. all abnormal error terminations, if any - but suppressed if any standard error output
In addition, $::errorCode previously always contained the termination status of the last
subcommand, even if it succeeded. Now it contains the termination status of the last
subcommand that failed, or "NONE" if all succeeded.
Additionally, the order of $::errorCode was previously wrong, with pid after the signal id
rather than vice versa.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
This applies to [exec] and [file tempfile]
Reported-by: Jakub Wilk
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Set umask so that temp files are created with
permissions 0600.
Courtesy of coverity.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Sweep through and clean up all (most) of the comments in the code.
While there, adjust some variable and function names to be more consistent,
and make a few small code changes - again, mostly for consistency.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Two versions of the "trim trailing space" function
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Otherwise there is no way to affect the environment for exec
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Tabs accidentally crept into source files in violaton of the style guide
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
e.g. exec prog <<$data
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
caused mayhem in stdio etc.
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Reported-by: af123 <jimdevel@hummypkg.org.uk>
|
|
On cygwin, setting environ before execvp() doesn't work,
but execvpe() does exist and works, so use that in preference
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Passing a zero refcount object to Jim_AioFilename() is a bad idea.
If the implementation changes, the object may be freed twice.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Simplifies the process of building loadable extensions
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
This also involves some restructuring of the existing
implementation to allow for as much reuse as possible.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Some unused variables
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Shared libraries can't access environ directly, so use
_NSGetEnviron() on Mac OS X
Also, load modules with (RTLD_NOW | RTLD_LOCAL) instead of RTLD_LAZY
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Use system() to implement [exec] if vfork() and waitpid()
are not available. This is just functional enough for simple tasks.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
And also a potentially undefined integer left shift
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
It is very common to get the string value
without the length. Jim_String() is a macro which does that.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Like Tcl, reap zombies on each exec invocation.
This commit also simplifies the implementation of exec
by using waitpid().
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
This allows systems with vfork() but not fork() to
have a full exec implementation, including constructs such
as 2>@1 and background exec with &
Also remove the --disable-fork option.
It doesn't really make sense now since exec uses vfork
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Ensure that no public headers include the autoconf
header, jimautoconf.h, as it leads to problems
with redefined symbols.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Like 'chan names' from Tcl
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Make the exec wait table allocated and per-interpeter
Use reentrant variants of some libc calls
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
All C extensions must call Jim_PackageProvide()
make-c-ext ensures that Tcl extensions call Jim_PackageProvide()
if compiled in.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Also, switch to using 'sh -c' for the vfork() implementation
because it then allows command line redirection, pipes and
setting the environment.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
This allows the return code from a failed 'exec' command to be retrieved.
Also support -errorcode in catch and return.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Use 'indent'. Not perfect, but at least consistent.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Including the --disable-fork case
And fix some compiler warnings
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Create and use config.h
Check for backtrace, fork, vfork, syslog, regcomp and others
Disable extensions which require missing functions/features
Check for one arg vs. two arg mkdir()
Distinguish between mingw and native windows
The aio extension has reduced functionality for ANSI C only
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Improve the ability to rethrow errors
* Allow return to rethrow an error by accepting '-errorinfo stacktrace'
* Also, 'catch ... opts' now also stores opts(-errorinfo) on error
* Use these to provide better stack traces from 'case' and 'try'
* Implement 'return -level'
Make try/on/finally more Tcl 8.6 compatible
* With support for 'on' handlers and docs
Add support for catch options to try
* Otherwise it's hard to use try to catch signals
Improvements to signal handling
* catch -signal now sets a list of the handled signals as the result
* catch -signal won't execute the body at all if a handled signal is pending
* up to 64 (jim_wide) signals can now be handled
* if catch -signal is nested, the innermost catch will catch the error
* new 'signal catch' allows ignored/blocked signals to be examined and cleared.
* update docs on signal handling
exec should indicate which signal killed the child
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Add some missing files needed for autoconf
Make jim build standalone and without host jimsh
Use (FILE *) for eventloop file handle
Don't expect to support dynlib if no mmu
Re-add nvp and win32 support (untested)
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
See TIP #202: http://www.tcl.tk/cgi-bin/tct/tip/202.html
|
|
Makes creating error messages much simpler
Also convert a couple of long if/else to switch
Also some error message improvements
Also fix some memory leaks
|