Macaulay2 / M2

The primary source code repository for Macaulay2, a system for computing in commutative algebra, algebraic geometry and related fields.
https://macaulay2.com
347 stars 231 forks source link

`runProgram`, when a program is killed, returns no value #2228

Closed DanGrayson closed 3 years ago

DanGrayson commented 3 years ago

runProgram, when a program is killed, returns no value.

In this demo, cat waits for input, so I kill it with killall -9 cat.

Macaulay2, version 1.18.0.1

i1 : cat = findProgram ("cat","cat </dev/null")

o1 = cat

o1 : Program

i2 : runProgram (cat, "")
stdio:2:1:(3): error: cat returned an error
running: /usr/bin/cat 
Killed
d-torrance commented 3 years ago

That's the current intended behavior of runProgram -- it raises an error if the program being run has a nonzero return value unless the RaiseError option is false:

i17 : runProgram(cat, "", RaiseError => false)

o17 = 15

o17 : ProgramRun
DanGrayson commented 3 years ago

Ah, okay, thank you.