os._exit(), os.kill(os.getpid(), 9) 
Author Message
 os._exit(), os.kill(os.getpid(), 9)

Hi,

Are those two equal?

os._exit(127)
os.kill(os.getpid(), 9)

regards,
Gerrit.

--
Please correct any bad English you encounter in my email message!
-----BEGIN GEEK CODE BLOCK----- http://www.*-*-*.com/
Version: 3.12
GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE?
Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y
-----END GEEK CODE BLOCK-----



Tue, 09 Jul 2002 03:00:00 GMT  
 os._exit(), os.kill(os.getpid(), 9)

Quote:

>os._exit(127)

This exits with exit code 127 and doesn't clean up...

Quote:
>os.kill(os.getpid(), 9)

Rather make that
os.kill(os.getpid(), signal.SIGKILL)

This makes the interpreter kill itself with SIGKILL. The exit code is
undefined.

Ergo those two are NOT equivalent.



Tue, 09 Jul 2002 03:00:00 GMT  
 os._exit(), os.kill(os.getpid(), 9)

Quote:


>>os._exit(127)

> This exits with exit code 127 and doesn't clean up...

how to exit with clean up?

--
                                                        Robert Milkowski



Tue, 09 Jul 2002 03:00:00 GMT  
 os._exit(), os.kill(os.getpid(), 9)

Quote:

> how to exit with clean up?

    sys.exit()

or

    sys.exit(errcode)

or

    raise SystemExit

</F>



Tue, 09 Jul 2002 03:00:00 GMT  
 os._exit(), os.kill(os.getpid(), 9)

    gerrit> Hi, Are those two equal?

    gerrit> os._exit(127) os.kill(os.getpid(), 9)

no, the parent process can tell if you've been killed by a signal or not.

Quote:
>>> def die():

...   if os.fork() == 0: os.kill(os.getpid(), 9)
...
Quote:
>>> def die2():

...   if os.fork() == 0: os._exit(127)
...
Quote:
>>> die()  
>>> os.wait()
(7003, 9)
>>> die2()
>>> os.wait()

(7004, 32512)

the os.W* functions can be used to extract sensible information out of
the status. it's works exactly the same way as in C, except W* aren't
macros...

  -- erno



Sun, 14 Jul 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Using os.getpid

2. Problem with any of os.system(), os.fork() & os.execp() and os.spawn()

3. Black OS/2 icons and mini-icons for VisualWorks 2.0 for OS/2

4. FORTH/OS OS/4th

5. Oberon OS/Genera Lisp OS connection?

6. OS/390 release test periods Re: default variable initialization under os/390 v2r8

7. FA: Virtual Pascal for OS/2, RexxVIM for OS/2

8. Script to change OS/2 full screen to OS/2 windowed

9. OS/2: Rexx Script from Win-OS file manager

10. Q:Using REXX under OS/2 how can you change an OS/2 window size

11. REXX-OS/2 and ECI for CICS-OS/2

12. Can OS/2 REXX call OS/2 REXX-???

 

 
Powered by phpBB® Forum Software