summary refs log tree commit diff stats
path: root/lib/system/io.nim
Commit message (Collapse)AuthorAgeFilesLines
* use lowercase --define switches (#17283)flywind2021-03-071-3/+3
|
* Use readable escape sequences (#17241)Clyybber2021-03-031-1/+1
|
* Replace double backticks with single backticks - Part 1 out of ~6 (#17205)Danil Yarantsev2021-02-281-18/+18
|
* Change stdlib imports to use std prefix in most examples (#17202)Danil Yarantsev2021-02-281-1/+1
|
* add io.readChars overload (simpler, less error prone) (#16044)Timothee Cour2021-02-221-4/+8
| | | | | | | | | | * add simpler to use readChars overload * use new readChars overload * Update lib/wrappers/openssl.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: flywind <xzsflywind@gmail.com>
* fix some warnings (#16952)flywind2021-02-081-12/+12
|
* Deprecate TaintedString (#15423)Juan Carlos2021-01-151-17/+17
| | | | Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
* fix #16502 (#16512)flywind2020-12-301-1/+1
|
* Make 'echo' raise IOErrors when appropriate (#16367)Matt Haggard2020-12-181-8/+16
| | | | | | | | | | | | | | | * Make 'echo' raise IOError when fwrite/fflush fail * Fix fwrite return value comparison * Add test for echo raising error and don't fail to release locks in echo * Fix exitcode expectation * Make 'echo' raise IOError on Windows if it fails * Add nimLegacyEchoNoRaise for prior no-IOError echo behavior * Use checkErrMaybe template
* Fix #14259 #15621 (#16322) [backport:1.4]rockcavera2020-12-121-4/+11
| | | | | | | | | | | | | | | | | * IPv6 text representation according to RFC 5952 * Revert IPv6 text representation according to RFC 5952 * fix #14259 #15621 fix #14259 #15621 * Update lib/system/io.nim * reverted IoHandle removal * adaptation of types for WinAPI Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Changes for FreeRTOS/LwIP Port for the ESP32 (ESP-IDF) (#15250)Jaremy Creechley2020-08-311-3/+9
| | | | | | | | | | | | | | | | | | | * Changes for FreeRTOS/LwIP Port for the ESP32 (ESP-IDF) Adding FreeRTOS/LwIP to compiler: * adding freertos option * dyncalls for freertos * add freertos to posix os list * adding lwip option Setting up networking FreeRTOS/LwIP Port: * setting up lwip network for freertos * fixing posix / networking for freertos * disable setInheritable for freerots * using lwip for net control items * Fix builds by ignoring lib/posix/posix_freertos_consts.nim similar to lib/posix/posix_other_consts.nim
* readLine: Unicode support for Windows console (#14782)Andreas Rumpf2020-07-201-0/+62
|\ | | | | | | | | | | | | | | | | | | | | | | * readLine: Unicode support for Windows console When input is read from the Windows console, input encoding is UTF16. This is translated internally to UTF8. * readLine: Remove recursive imports * readLine: Fix issues with --gc:arc **--gc:arc** defines **nimv2**. This changes the definition of **WideCStringObj**. Also an empty string should be returned in case of EOF.
| * readLine: Fix issues with --gc:arcktamp2020-06-261-6/+11
| | | | | | | | **--gc:arc** defines **nimv2**. This changes the definition of **WideCStringObj**. Also an empty string should be returned in case of EOF.
| * readLine: Remove recursive importsktamp2020-06-251-10/+31
| |
| * readLine: Unicode support for Windows consolektamp2020-06-231-0/+36
| | | | | | When input is read from the Windows console, input encoding is UTF16. This is translated internally to UTF8.
* | io: fix SetHandleInformation signature to match Windows' (#15017)alaviss2020-07-201-2/+7
|/ | | | | | | * io: fix SetHandleInformation signature to match Windows' Fixes #14980 * rename Handle -> IoHandle because system.nim is a mess
* init checks and 'out' parameters (#14521)Andreas Rumpf2020-06-231-8/+8
| | | | | | | | | | | * I don't care about observable stores * enforce explicit initializations * cleaner code for the stdlib * stdlib: use explicit initializations * make tests green * algorithm.nim: set result explicitly * remove out parameters and bring the PR into a mergable state * updated the changelog
* io: correct signature for some win32 apis (#14551)alaviss2020-06-031-5/+5
| | | See https://github.com/nim-lang/Nim/pull/14550#issuecomment-637937649
* hotfix doc comments for procs without body (#14494)Timothee Cour2020-05-291-5/+0
|
* trunner was not actually being tested in non-CTFFI mode; minor testament ↵Timothee Cour2020-05-191-1/+1
| | | | | | | | | | cleanups (#14377) * use check * trunner now works with cpp * cleanup: move compiler/unittest_light => stdtest/unittest_light * fix tests/readme.md * remove deadcode references to rodfiles * fix for windows
* move since from inclrtl to std/private/since (#14188)hlaaftana2020-05-021-0/+1
| | | | * move since from inclrtl to std/private/since * move since import in system below for HCR
* change 'iff' to 'if' to stop "corrections" once and for all (#14182)Miran2020-05-011-4/+4
|
* Make file descriptors from stdlib non-inheritable by default (#13201)alaviss2020-04-201-5/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * io: make file descriptors non-inheritable by default This prevents file descriptors/handles leakage to child processes that might cause issues like running out of file descriptors, or potential security issues like leaking a file descriptor to a restricted file. While this breaks backward compatibility, I'm rather certain that not many programs (if any) actually make use of this implementation detail. A new API `setInheritable` is provided for the few that actually want to use this functionality. * io: disable inheritance at file creation time for supported platforms Some platforms provide extension to fopen-family of functions to allow for disabling descriptor inheritance atomically during File creation. This guards against possible leaks when a child process is spawned before we managed to disable the file descriptor inheritance (ie. in a multi-threaded program). * net, nativesockets: make sockets non inheritable by default With this commit, sockets will no longer leak to child processes when you don't want it to. Should solves a lot of "address in use" that might occur when your server has just restarted. All APIs that create sockets in these modules now expose a `inheritable` flag that allow users to toggle inheritance for the resulting sockets. An implementation of `setInheritance()` is also provided for SocketHandle. While atomically disabling inheritance at creation time is supported on Windows, it's only implemented by native winsock2, which is too much for now. This support can be implemented in a future patch. * posix: add F_DUPFD_CLOEXEC This command duplicates file descriptor with close-on-exec flag set. Defined in POSIX.1-2008. * ioselectors_kqueue: don't leak file descriptors File descriptors internally used by ioselectors on BSD/OSX are now shielded from leakage. * posix: add O_CLOEXEC This flag allows file descriptors to be open() with close-on-exec flag set atomically. This flag is specified in POSIX.1-2008 * tfdleak: test for selectors leakage Also simplified the test by using handle-type agnostic APIs to test for validity. * ioselectors_epoll: mark all fd created close-on-exec File descriptors from ioselectors should no longer leaks on Linux. * tfdleak: don't check for selector leakage on Windows The getFd proc for ioselectors_select returns a hardcoded -1 * io: add NoInheritFlag at compile time * io: add support for ioctl-based close-on-exec This allows for the flag to be set/unset in one syscall. While the performance gains might be negliable, we have one less failure point to deal with. * tfdleak: add a test for setInheritable * stdlib: add nimInheritHandles to restore old behaviors * memfiles: make file handle not inheritable by default for posix * io: setInheritable now operates on OS file handle On Windows, the native handle is the only thing that's inheritable, thus we can assume that users of this function will already have the handle available to them. This also allows users to pass down file descriptors from memfiles on Windows with ease, should that be desired. With this, nativesockets.setInheritable can be made much simpler. * changelog: clarify * nativesockets: document setInheritable return value * posix_utils: atomically disable fd inheritance for mkstemp
* fix #13829 (#13831)Timothee Cour2020-04-011-1/+1
|
* __stderrp and friends are only on FreeBSD & DragonFlyBSD. (#13735)Euan2020-03-231-1/+1
|
* fix #9634 don't crash on execCmdEx/readLine when inside gdb/lldb (#13232)Timothee Cour2020-02-111-2/+15
| | | | | | | | * fix #9634 debugging a program using execCmdEx now works * only apply EINTR to c_gets for now This reverts commit c0f5305b5a0b46983dfd27e3d77ecbf4f8744dcc.
* [backport] fix #13352narimiran2020-02-071-0/+3
|
* enable testing -d:nimHasLibFFI mode (#13091)Timothee Cour2020-02-041-1/+1
|
* fix stdout(etc) for emscriptenTimothee Cour2020-01-281-3/+4
|
* Added 'ansic' os support for minimal (embedded) targets (#13088)Ico Doornekamp2020-01-151-2/+2
| | | | | | | | * os:any implementation * os:asny: omit flock/funlock calls in echoBinSafe * Disabled default "unhandled expection" reporting for `--os:any` to reduce code size. Added unhandledExceptionHook instead which can be used to get a notification from Nim and handle it from the application.
* VM FFI: write(stderr, msg) and fprintf(cstderr, msg) now work at CT (#13083)Timothee Cour2020-01-121-3/+8
|
* [backport] system/io.nim fix wrong documentation comment [ci skip]narimiran2020-01-101-2/+2
|
* fixes #13013, reverts previous changes to readLines() (#13036) [backport]cooldome2020-01-051-3/+5
| | | | | | | * Revert "remove default argument for readLines (#12807) [backport]" This reverts commit c949b81efdeb08b38224e1678ad140b7b7663b15.
* remove default argument for readLines (#12807) [backport]cooldome2020-01-021-3/+3
|
* minor refactoringsAndreas Rumpf2019-12-271-9/+9
|
* added 'since' template for further stdlib additionsAndreas Rumpf2019-11-071-1/+1
|
* introduce csize_t instead of fixing csize (#12497)Arne Döring2019-10-311-9/+9
|
* fix several typos in documentation and comments (#12553)Nindaleth2019-10-301-2/+2
|
* fix deprecation warnings related to Int128 (#12474)Miran2019-10-281-1/+1
| | | | | | | | * semfold: fix deprecation warnings related to Int128 * semmagic: fix deprecation warnings related to Int128 * system/io: remove unneeded conversion of TaintedString to itself
* Revert "Fixes #12187 (#12321)" (#12447)Andreas Rumpf2019-10-181-11/+3
| | | This reverts commit 00c31e87660d9db813871f5aa23661bf6b9bbdcb.
* fix a few dead links and a missing sentence in documentation (#12387)Nindaleth2019-10-081-3/+3
|
* fixes #12315 [backport]; refs #12314 (#12385)Andreas Rumpf2019-10-081-0/+6
|
* Fixes #12187 (#12321)Clyybber2019-10-081-3/+11
| | | | | | * Fixes #12187 * Point to fork of compactdict Since the original repo is now archived / read-only
* `system.writeFile` has been overloaded to also support `openarray[byte]` ↵zah2019-10-021-0/+12
| | | | | | (#12313)
* consistent floating point output (#12219)Andreas Rumpf2019-09-201-2/+9
| | | | | * unify float printing * makes tests green
* Add -d:androidNDK to fix echo on Android NDK builds. (#12203)treeform2019-09-171-19/+32
| | | | | | | | * Add -d:echoToAndroidLog to fix echo. * Change to androidNDK and add docs. * Some word changes to docs.
* more enhancements for #11618 (#11976)Andreas Rumpf2019-08-181-2/+25
| | | | | | * finish the Windows IO layer changes; refs #11618 * added system.getOsFileHandle which is less error-prone on Windows * make tests green again
* fixes #11618 (#11969)Andreas Rumpf2019-08-171-4/+28
|
* fixes #11801Araq2019-08-161-1/+1
|
* styleCheck: make the compiler and large parts of the stdlib compatible with ↵Araq2019-07-101-8/+8
| | | | --styleCheck:error