plash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Plash] Question about file descriptors


From: Thomas Leonard
Subject: [Plash] Question about file descriptors
Date: Sat, 28 Feb 2009 17:00:35 +0000

I'm trying to pass a file descriptor to a process running under
pola-run, but it doesn't seem to work:

$ python -c 'import os; print os.read(5, 100)' 5< /etc/hosts
127.0.0.1       localhost

$ pola-run -f / -e python -c 'import os; print os.read(5, 100)' 5< /etc/hosts
OSError: [Errno 9] Bad file descriptor

Strangely, though, this works:

$ python -c 'import os; print file("/proc/self/fd/5").read()' 5< /etc/hosts
127.0.0.1       localhost

Also happens with bash:

$ pola-run -fw=/ --prog /bin/bash 5< /etc/hosts
cat <&5
/bin/bash: line 1: 5: Bad file descriptor
cat /proc/self/fd/5
127.0.0.1       localhost

It works if I use FD 0 rather than 5, too. I see _set_up_fds() calls
close() a lot. Is this necessary?

This is using the Lenny package on Ubuntu/Intrepid.

Thanks,


-- 
Dr Thomas Leonard               ROX desktop / Zero Install
GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]