diff --git a/extra/io/unix/files/files.factor b/extra/io/unix/files/files.factor index c1e4d319ce..c4f10ebb7b 100755 --- a/extra/io/unix/files/files.factor +++ b/extra/io/unix/files/files.factor @@ -12,8 +12,7 @@ M: unix cwd ( -- path ) MAXPATHLEN [ ] [ ] bi getcwd [ (io-error) ] unless* ; -M: unix cd ( path -- ) - chdir io-error ; +M: unix cd ( path -- ) [ chdir ] unix-system-call drop ; : read-flags O_RDONLY ; inline @@ -24,8 +23,7 @@ M: unix (file-reader) ( path -- stream ) : write-flags { O_WRONLY O_CREAT O_TRUNC } flags ; inline -: open-write ( path -- fd ) - write-flags file-mode open dup io-error ; +: open-write ( path -- fd ) write-flags file-mode open-file ; M: unix (file-writer) ( path -- stream ) open-write ; @@ -33,7 +31,7 @@ M: unix (file-writer) ( path -- stream ) : append-flags { O_WRONLY O_APPEND O_CREAT } flags ; inline : open-append ( path -- fd ) - append-flags file-mode open dup io-error + append-flags file-mode open-file [ dup 0 SEEK_END lseek io-error ] [ ] [ close ] cleanup ; M: unix (file-appender) ( path -- stream ) @@ -45,7 +43,7 @@ M: unix (file-appender) ( path -- stream ) M: unix touch-file ( path -- ) normalize-path dup exists? [ touch ] [ - touch-mode file-mode open close + touch-mode file-mode open-file close ] if ; M: unix move-file ( from to -- ) diff --git a/extra/io/unix/launcher/launcher.factor b/extra/io/unix/launcher/launcher.factor index 043b2bd73e..1a0bab73c3 100755 --- a/extra/io/unix/launcher/launcher.factor +++ b/extra/io/unix/launcher/launcher.factor @@ -44,7 +44,7 @@ USE: unix : redirect-file ( obj mode fd -- ) >r >r normalize-path r> file-mode - open dup io-error r> redirect-fd ; + open-file r> redirect-fd ; : redirect-file-append ( obj mode fd -- ) >r drop path>> normalize-path open-append r> redirect-fd ;