From 02f5b58c40413439a3b84b7bf04cad463b1d7334 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20B=C3=BChler?= <david.buhler@cea.fr>
Date: Fri, 22 Oct 2021 16:19:20 +0200
Subject: [PATCH] [ivette] Show a status message when failing to open the
 external editor.

---
 ivette/src/frama-c/kernel/SourceCode.tsx | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/ivette/src/frama-c/kernel/SourceCode.tsx b/ivette/src/frama-c/kernel/SourceCode.tsx
index e01349ab1ef..71d7a051e53 100644
--- a/ivette/src/frama-c/kernel/SourceCode.tsx
+++ b/ivette/src/frama-c/kernel/SourceCode.tsx
@@ -38,6 +38,7 @@ import { Code } from 'dome/controls/labels';
 import { Hfill } from 'dome/layout/boxes';
 import * as Path from 'path';
 import * as Settings from 'dome/data/settings';
+import * as Status from 'frama-c/kernel/Status';
 
 import CodeMirror from 'codemirror/lib/codemirror';
 import 'codemirror/addon/selection/active-line';
@@ -104,7 +105,12 @@ export default function SourceCode() {
       .replace('%c', selectedChar);
     const args = cmd.split(' ');
     const prog = args.shift();
-    if (prog) System.spawn(prog, args).catch(/* TODO */);
+    if (prog) System.spawn(prog, args).catch(() => {
+      Status.setMessage({
+        text: `An error has occured when opening the external editor ${prog}`,
+        kind: 'error',
+      });
+    });
   };
 
   // Building the React component.
-- 
GitLab