From d134123793dffbe79f4e9618e46ec18cd134ab2c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Loi=CC=88c=20Correnson?= <loic.correnson@cea.fr>
Date: Tue, 14 Dec 2021 13:47:50 +0100
Subject: [PATCH] [ivette/server] fix command line

---
 ivette/src/frama-c/client.ts        | 3 +++
 ivette/src/frama-c/client_socket.ts | 5 +++++
 ivette/src/frama-c/client_zmq.ts    | 8 +++++---
 ivette/src/frama-c/server.ts        | 2 +-
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/ivette/src/frama-c/client.ts b/ivette/src/frama-c/client.ts
index 526c942b6b8..d9cd89613c4 100644
--- a/ivette/src/frama-c/client.ts
+++ b/ivette/src/frama-c/client.ts
@@ -28,6 +28,9 @@ import { json } from 'dome/data/json';
 
 export interface Client {
 
+  /** Server CLI */
+  commandLine(sockaddr: string, params: string[]): string[];
+
   /** Connection */
   connect(addr: string): void;
 
diff --git a/ivette/src/frama-c/client_socket.ts b/ivette/src/frama-c/client_socket.ts
index 55be45c292f..cab6beb75b7 100644
--- a/ivette/src/frama-c/client_socket.ts
+++ b/ivette/src/frama-c/client_socket.ts
@@ -40,6 +40,11 @@ class SocketClient implements Client {
   queue: json[] = [];
   buffer: Buffer = Buffer.from('');
 
+  /** Server CLI */
+  commandLine(sockaddr: string, params: string[]): string[] {
+    return ['-server-socket', sockaddr, '-then'].concat(params);
+  }
+
   /** Connection */
   connect(sockaddr: string): void {
     if (this.socket) {
diff --git a/ivette/src/frama-c/client_zmq.ts b/ivette/src/frama-c/client_zmq.ts
index e3432ca39a5..29db9cad74d 100644
--- a/ivette/src/frama-c/client_zmq.ts
+++ b/ivette/src/frama-c/client_zmq.ts
@@ -33,15 +33,17 @@ const pollingTimeout = 50;
 
 class ZmqClient implements Client {
 
-  constructor() { }
-
   events = new Emitter();
-
   queueCmd: string[] = [];
   queueId: string[] = [];
   zmqSocket: ZmqRequest | undefined;
   zmqIsBusy = false;
 
+  /** Server CLI */
+  commandLine(sockaddr: string, params: string[]): string[] {
+    return ['-server-zmq', sockaddr, '-then'].concat(params);
+  }
+
   /** Connection */
   connect(sockaddr: string): void {
     if (!this.zmqSocket) {
diff --git a/ivette/src/frama-c/server.ts b/ivette/src/frama-c/server.ts
index 5c2ba0038e9..4edad8f1676 100644
--- a/ivette/src/frama-c/server.ts
+++ b/ivette/src/frama-c/server.ts
@@ -458,7 +458,7 @@ async function _launch() {
   if (!cwd) cwd = System.getWorkingDir();
   logout = logout && System.join(cwd, logout);
   logerr = logerr && System.join(cwd, logerr);
-  params = ['-server-zmq', sockaddr, '-then'].concat(params);
+  params = client.commandLine(sockaddr, params);
   const options = {
     cwd,
     stdout: { path: logout, pipe: true },
-- 
GitLab