I am trying to hide a process from a python script and don't know if I
can do so.

The process is a pax command, and my unsucesful code is below.

I am trying to read from a pax archive (similar to a tar archive) to get
a list of files. As long as the pax archive is valid, the code below
works fine.

The problem arises when the pax archive is not valid. In this case, the
pax commnad gives this message:

ATTENTION! pax archive volume change required.
Ready for archive volume: 1
Input archive name or "." to quit pax.
Archive name > 

pax then waits for the user to type in a command.

I would like to supress both the message and the need for user input,
because whenever this message appears, it always means the pax archive
is corrupt. So ther is no need to see this confusing and misleading
message.

However, no matter what I have tried, I can't get away from pax both
displaying the message and demanding the user type in a command. Do I
need to fork a process? I have never done this, and the documentation is
confusing to me. 

Thanks

Paul



    def make_verify_list(self, archive, write_obj):
        if self.__main.verbose:
            sys.stdout.write('Making file from archive...\n')
        if self.__main.platform == 'darwin':
            command = 'hfspax -f %s ' % archive
        elif self.__main.platform == 'linux':
            command = 'pax -f %s' % archive


        junk_obj, read_obj, error_obj = os.popen3(command )
        errors = []
        line = 1
        while 1:
            line = read_obj.readline()
            if line:
                #  add a leading /, which was stripped away
                line = '/%s' % line
                line = line.replace('//', '/')
                index = line.find('\/..namedfork\/rsrc$')
                if index > -1:
                    continue
                index = line.find('\/..namedfork\/finf$')
                if index > -1:
                    continue
                write_obj.write(line)
            else:
                break



        # test for errors
        error_result = error_obj.readlines()
        read_obj.close()
        junk_obj.close()
        error_obj.close()
        if error_result:
            return 1

-- 

************************
*Paul Tremblay         *
[EMAIL PROTECTED]
************************
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to