aboutsummaryrefslogtreecommitdiff
path: root/jim-exec.c
AgeCommit message (Collapse)AuthorFilesLines
2011-11-07Allow building with MSVC on windowsSteve Bennett1-3/+6
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-09-13exec was not removing temp filesSteve Bennett1-1/+2
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-09-12Implement full [exec] on mingw/msysSteve Bennett1-253/+750
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>
2011-07-22Fix an instance of declaration after codeSteve Bennett1-3/+3
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-07-07Minor code cleanupsSteve Bennett1-9/+10
Some unused variables Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-06-09Better handling of environ on Mac OS XSteve Bennett1-8/+6
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>
2011-06-09Provide a fallback basic [exec] for (e.g.) mingw32Steve Bennett1-5/+68
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>
2011-06-03Fix some clang warningsSteve Bennett1-1/+7
And also a potentially undefined integer left shift Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-06-01Add Jim_String() macroSteve Bennett1-4/+4
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>
2011-05-27Ensure detached child processes are reapedSteve Bennett1-131/+57
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>
2011-05-18Fix memory leak on exec argument errorSteve Bennett1-8/+7
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-12-15Use vfork() instead of fork() in [exec]Steve Bennett1-232/+87
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>
2010-11-17Add attributions to jim-exec.c from Tcl 6.7Steve Bennett1-1/+6
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-11-09Allow jim to be used as an autoconf subdirSteve Bennett1-0/+1
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>
2010-10-30Add 'info channels'Steve Bennett1-9/+0
Like 'chan names' from Tcl Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Add stubs in case of compiled-out package, aioSteve Bennett1-0/+9
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Make jim more reentrantSteve Bennett1-61/+87
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>
2010-10-15Ensure that Tcl extensions can be built-in or externalSteve Bennett1-0/+3
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>
2010-10-15Use $::env to build environment for execSteve Bennett1-12/+137
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>
2010-10-15Clean up some debuggingSteve Bennett1-1/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Reduce excessive stack usageSteve Bennett1-1/+0
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Set $::errorCode from execSteve Bennett1-11/+38
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>
2010-10-15Clean up the indentation messSteve Bennett1-105/+114
Use 'indent'. Not perfect, but at least consistent. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix exec with vfork()Steve Bennett1-59/+66
Including the --disable-fork case And fix some compiler warnings Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Improvements to jim configureSteve Bennett1-3/+4
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>
2010-10-15Improvements to catch, return, signal, trySteve Bennett1-1/+6
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>
2010-10-15Fix some build problems and add lost featuresSteve Bennett1-2/+2
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>
2010-10-15Add exec support for 2>@1Steve Bennett1-7/+19
See TIP #202: http://www.tcl.tk/cgi-bin/tct/tip/202.html
2010-10-15Add Jim_SetResultFormatted() for simplied messagesSteve Bennett1-10/+5
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
2010-10-15Various general fixes and cleanupsSteve Bennett1-1/+1
Add lsearch -command, update case to use lsearch Rename tcl6.tcl to tclcompat.tcl Remove // style comments Expand some tabs to spaces Fix some compiler warnings Remove some unused functions Don't close fd=-1 in exec
2010-10-15Tests, ehancements and bug fixes for execSteve Bennett1-14/+38
Add Tcl tests for exec Fix some errors exposed by these tests Add support for >&, >>&, |&
2010-10-15Bug fixes, documentation updatesSteve Bennett1-1/+3
jimsh - retry on EINTR from fgets() Fix 0 -> NULL for 64 bit systems Fix overlapping memcpy Fix jim array dereferencing bug *: Counting of parentheses was incorrect with nested array references *: The result for array dereference wasn't being used properly Add os.uptime command Documentation: autogenerated command index Fix gets when last line has no newline
2010-10-15exec fixes, add os.waitSteve Bennett1-6/+14
Ensure that exec returns an error if appropriate Background exec returns a list of pids Need to close error filedescriptor Add os.wait
2010-10-15Enhance exec, bioSteve Bennett1-42/+137
Support @filehandle syntax Support for nommu Disable os.fork for nommu Remove trailing newline No need for binary escaping in bio module ------------------------------------------------------------------------
2010-10-15Small improvementsSteve Bennett1-2/+3
Save (but then cleanup) generated extensions Add package and readdir to 'all' extensions Order of static extensions matters!! Simple C define support for configured extensions Fix some compiler warnings
2010-10-15Make static extensions buildSteve Bennett1-1/+1
Also clean up some white space
2010-10-15Add file and exec (along with subcmd support)Steve Bennett1-0/+928