aboutsummaryrefslogtreecommitdiffstats
path: root/run/proc_entry.py
blob: 56f7c24254f1329c94ccc94968c161f5067a713e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import os

class ProcEntry(object):
    def __init__(self, proc, data):
        self.proc = proc
        self.data = data

        if not os.path.exists(self.proc):
            raise ValueError("Invalid proc entry %s" % self.proc)

    def write_proc(self):
        try:
            with open(self.proc, 'w') as entry:
                entry.write(self.data)
        except:
            print("Failed to write into %s value:\n%s" % (self.proc, self.data))