summaryrefslogtreecommitdiff
path: root/src/lib/ecore/efl_exe.eo
blob: c4cc2d7ebf6d64dde05416aa00754079ec0881fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
enum @beta Efl.Exe_Signal {
   [[Signal is a notification, a message sent by either operating system or some application to our program.
     Signals are a mechanism for one-way asynchronous notifications. A signal may be sent from the kernel to
     a process, from a process to another process, or from a process to itself. Signal typically alert a
     process to some event, such as a segmentation fault, or the user pressing Ctrl-C.]]
   int,  [[Terminal interrupt.]]
   quit, [[Terminal quit.]]
   term, [[Termination.]]
   kill, [[Kill(can't be caught or ignored).]]
   cont, [[Continue executing, if stopped.]]
   stop, [[Stop executing(can't be caught or ignored).]]
   hup,  [[Hangup.]]
   usr1, [[User defined signal 1.]]
   usr2  [[User defined signal 2.]]
}

enum @beta Efl.Exe_Flags {
   [[Flags to customize process behavior.]]
   none             = 0, [[No special flags.]]
   group_leader     = 1, [[Process will be executed in its own session.]]
   hide_io          = 4,  [[All console IO will be hidden.]]
   term_with_parent = 8,  [[Makes child receive SIGTERM when parent dies.]]
}

class @beta Efl.Exe extends Efl.Task implements Efl.Io.Reader, Efl.Io.Writer, Efl.Io.Closer, Efl.Core.Command_Line
{
   [[This is a specialized @Efl.Task which abstracts an operating system process.
     This class provides a way to start a task by running an executable file (specified using the
     @Efl.Core.Command_Line interface) and further customize its execution flags (@.exe_flags) and
     environment variables (@.env).
     It also allows communicating with the process through signals (@.signal).
   ]]
   methods {
      signal {
         [[Send a signal to this process.]]
         params {
            sig: Efl.Exe_Signal; [[Signal number to send.]]
         }
      }
      @property exe_flags {
        [[Customize the process' behavior.]]
        set { }
        get { }
        values {
          flags: Efl.Exe_Flags; [[Flags.]]
        }
      }
      @property exit_signal {
         [[The signal this process emitted upon exiting, if any.]]
         get { }
         values {
            sig: int; [[The exit signal, or -1 if no exit signal happened.]]
         }
      }
      @property pid {
         [[The pid of the process, which is only accessible after the object has been finalized.
           @since 1.24
         ]]
         get { }
         values {
            pid: int; [[The pid, or 0 on failure.]]
         }
      }
      @property env {
         [[If $env is $NULL then the process created by this object is
           going to inherit the environment of this process.

           In case $env is not $NULL then the environment variables declared
           in this object will represent the environment passed to the new process.
         ]]
         get {
         }
         set {
         }
         values {
            env : Efl.Core.Env; [[$env will be referenced until this object does not need it anymore.]]
         }
      }
   }
   implements {
      Efl.Object.constructor;
      Efl.Object.destructor;
      Efl.Task.priority { get; set; }
      Efl.Task.run;
      Efl.Task.end;
      Efl.Io.Closer.close;
      Efl.Io.Closer.closed { get; }
      Efl.Io.Reader.read;
      Efl.Io.Reader.can_read { get; set; }
      Efl.Io.Reader.eos { get; set; }
      Efl.Io.Writer.write;
      Efl.Io.Writer.can_write { get; set; }
   }
}