예제 #1
0
파일: myshell.py 프로젝트: max01598/S3
while 1:
    commande = input('Entrez une commande \n')
    pid = os.fork()
    lng = len(commande)
    dernierchar = commande[lng - 1]
    tblcmd = commande.split()
    status = 0

    if pid == 0:
        if dernierchar == '&':
            try:
                os.execvp(tblcmd[0], tblcmd[0:len(tblcmd) - 1])
            except OSError as e:
                errno = e.get_er
                os.sterror('Commande inconnue ', e.strerror)
                fflush(stdout)
        else:
            try:
                os.execvp(tblcmd[0], tblcmd[0:])
            except OSError as e:
                errno = e.get_er
                os.sterror('Commande inconnue ', e.strerror)
                fflush(stdout)
    elif pid > 0:

        if dernierchar == '&':
            print('Execution en arriere plan')
        else:
            status = os.wait()
            print('Pid du fils ', status[0])
예제 #2
0
 def __init__(self, error_message):
     if hasattr(errno, 'ETIME'):
         self.message = os.sterror(errno.ETIME)
     else:
         self.messaage = error_message
예제 #3
0
 def __init__(self, error_message):
     if hasattr(errno, "ETIME"):
         self.message = os.sterror(errno.ETIME)
     else:
         self.messaage = error_message