exec in newlisp 10.7.1/Windows

Started by Cyril, February 17, 2017, 10:29:34 AM

Previous topic - Next topic

Cyril

Seems like exec in newlisp 10.7.1/Windows opens it's second argument in text (as opposed to binary) mode. Test:
(exec "od -b" "hellornworldrn")
Output with newlisp 10.6.2
0000000 150 145 154 154 157 015 012 167 157 162 154 144 015 012
Output with newlisp 10.7.1
0000000 150 145 154 154 157 015 015 012 167 157 162 154 144 015 015 012
I suppose this is a side effect of the change to a newer MinGW. But still confusing - "binary mode everywhere" policy was consistent so far.
With newLISP you can grow your lists from the right side!

Lutz

#1
The translation from "n" to "rn" happens in the newer MINGW development system call popen() or _popen(). Both do the same text translation in current MINGW versions used.



In newLISP popen() is used only in the exec function and when writing CGI output in newLISP builtin web server (nl-web.c).



When using text just use the UNIX "n" line-feed format as input on both UNIX and Windows. When you need strictly binary format on Windows then convert data to a binary file first then use exec on that:



> (write-file "binfile" "nnn")
3
> (exec "od -b binfile")
("0000000   012 012 012" "0000003")
>


and it will not do the Windows linefeed text translation.