4 ms·
> dumping your program's stdout to /dev/null should result in an error That's not what's happening though. The invocation is: hello 1< /dev/null i.e. std
by dbaupp 13y ago
> dumping your program's stdout to /dev/null should result in an error
That's not what's happening though. The invocation is:
hello 1< /dev/null
i.e. stdout is read-only, and it seems reasonable that that should be an error.
- markeganfuller 13y agoThis is a very strange way of 'faking' a read-only file and after testing Python, it handles real read-only files fine -rw-r--r-- 1 root root 0 Jun 10 17:28 test python hello.py > test bash: test: Permission denied echo $? 1
- talex5 13y agoThe "Permission Denied" message you see here is from your shell, not Python. But note the test isn't about whether you can open the file successfully, but about detecting writes to an open file failing (e.g. because the disk becomes full during writing).
- markeganfuller 13y agoHis example focused on the program return code which in this case is correctly 1