remove t
This commit is contained in:
parent
c1bec161be
commit
e7f9037976
10
t/b.sh
10
t/b.sh
@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo $$ > /var/tmp/surok.spid
|
||||
|
||||
while true; do
|
||||
cat txt
|
||||
sleep 2
|
||||
done
|
34
t/f.py
34
t/f.py
@ -1,34 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
from time import sleep
|
||||
import sys
|
||||
|
||||
|
||||
def child():
|
||||
bashCommand = "./b.sh"
|
||||
process = subprocess.Popen(bashCommand, stdout=sys.stdout)
|
||||
# output = process.communicate()
|
||||
|
||||
return process
|
||||
|
||||
|
||||
def parent():
|
||||
newpid = os.fork()
|
||||
if newpid == 0:
|
||||
child()
|
||||
else:
|
||||
pids = (os.getpid(), newpid)
|
||||
print("parent: %d, child: %d\n" % pids)
|
||||
|
||||
c = 0
|
||||
while c < 5:
|
||||
sleep(2)
|
||||
p = open('/var/tmp/surok.spid')
|
||||
cpid = p.read()
|
||||
p.close()
|
||||
print(cpid, c)
|
||||
c = c + 1
|
||||
|
||||
parent()
|
Loading…
Reference in New Issue
Block a user