Bonjour,
je dispose d'un programme sous windows qui me permet de lancer un autre executable et qui me permet de le piloter via le stdin/stdout et stderr.
En effet je dispose de pipes pour chaque flux et ainsi pour le controle est réalisé via des lectures et des écritures dans ces tubes nommés.
(Je recupere son affichage via le processus "mère")

J'aimerai faire la même chose sous Linux.
Est ce possible ?
Comment s'y prendre ?

Merci d'avance.

Je laisse pour les non-allergiques de code purement API-Windows un peu d'exemples de mon code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
SECURITY_ATTRIBUTES sa = {
   sizeof(SECURITY_ATTRIBUTES), 
    0, true
  };
  HANDLE hProc = GetCurrentProcess();
 
  CreatePipe(&hOutputReadTmp, &hOutputWrite, &sa, 0);
 
  CreatePipe(&hInputRead, &hInputWriteTmp, &sa, 0);
 
  CreatePipe(&hErrorReadTmp, &hErrorWrite, &sa, 0);
 
  DuplicateHandle(hProc, hErrorReadTmp, hProc, 
   &hErrorRead, 0, false, DUPLICATE_SAME_ACCESS);
 
  DuplicateHandle(hProc, hOutputReadTmp, hProc, 
   &hOutputRead, 0, false, DUPLICATE_SAME_ACCESS);
 
  DuplicateHandle(hProc, hInputWriteTmp, hProc, 
   &hInputWrite, 0, false, DUPLICATE_SAME_ACCESS);
 
...
 
 STARTUPINFO suinfo = {
  sizeof(STARTUPINFO), // cb
   0, 0,     // reserved
   0,      // lpTitle
   0, 0,     // dwX, dwY
   0, 0,     // dwXSize, dwYSize
   0, 0,     // dwXCountChars, dwYCountChars
   0,      // dwFillAttribute
   STARTF_USESTDHANDLES |
   STARTF_USESHOWWINDOW, // dwFlags
   l_wShowWindow,      // wShowWindow
   0, 0,     // reserved
   hInputRead,    // hStdInput;
   hOutputWrite,   // hStdOutput;
   hErrorWrite,   // hStdError;
 };
 
...
 
 successfulrun = CreateProcess(
  0,
  const_cast<char*>(params),
  &sa,0,
  true, 
  0,
  0,
  0,
  &suinfo,
  &pinfo) != false;
 
...
 
ReadFile(hOutputRead, &c, 1, &ic, 0) //lecture
...
 
 WriteFile(hInputWrite, buf, strlen(buf), &ic, 0); //ecriture
 
...
Merci.