11 ms·
I'm no cobol expert, but does this just shell out to 'node -e "' + code + '"' ? What if code contains a " ? https://github.com/IonicaBizau/node.cobol/blob
by 0x0 10y ago
I'm no cobol expert, but does this just shell out to
'node -e "' + code + '"'
? What if code contains a " ?
https://github.com/IonicaBizau/node.cobol/blob/master/lib/node-exec.cbl https://github.com/IonicaBizau/node.cobol/blob/master/lib/no...
- squeaky-clean 10y agoI've never used cobol, but I'm pretty sure doing so would fail. "node-exec-path.cbl" is for this, you can give it a path to a script to run. The example uses it as CALL 'EXEC_NODEJS_FILE' USING "example/server.js". Alternatively, you can escape double quotations to \" and they'll work with node -e (I'm pretty sure it's not doing this automatically though). I think I found another bug too, my only experience with cobol is the 10 minutes spent trying to understand this, so maybe someone can explain? Since in EXEC_NODEJS, NODEJS_CODE is defined as "NODEJS_CODE PIC A(100)", doesn't that limit it to 100 alphabetic characters, so even the example of "console.log('Hello World!')" would not work because of the period, parentheses, and exclamation mark?
- ahlatimer 10y agoMy first job as a developer was writing COBOL (in 2007), and I only did it for a few months, so grain of salt here. I'm fairly certain PIC A(100) should be PIC X(100). A is "alphabetic." X is "alphanumeric" but supports ASCII characters that aren't a-z or 0-9. That said, COBOL is weakly typed, so you can probably store non-alphabetic characters in a variable typed as alphabetic (at least without the compiler correcting you), but it might fail if you try to do certain operations on them.
- rhizome 10y agoYeah buddy! I was a screen-colorer for a large COBOL app in the mid-late 90s.