[beast: 8/47] V8BSE: workaround electron concatenating argv[1:] in argv[0]



commit 9a40ed8d8c1600eb19c013d910853624014b5458
Author: Tim Janik <timj gnu org>
Date:   Fri May 26 00:39:22 2017 +0200

    V8BSE: workaround electron concatenating argv[1:] in argv[0]
    
    Signed-off-by: Tim Janik <timj gnu org>

 ebeast/v8bse/nodemodule.cc |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/ebeast/v8bse/nodemodule.cc b/ebeast/v8bse/nodemodule.cc
index d84c026..4185b6b 100644
--- a/ebeast/v8bse/nodemodule.cc
+++ b/ebeast/v8bse/nodemodule.cc
@@ -214,6 +214,10 @@ v8bse_register_module (v8::Local<v8::Object> exports)
 
   v8::HandleScope scope (isolate);
 
+  // workaround electron concatenating argv[1:] in argv[0]
+  if (Bse::program_alias().find ("electron ") != std::string::npos)
+    Bse::program_alias (Bse::Path::cwd()); // a guess at the actual electron application
+
   // prepare Bse environment
   const char *canary = "library/demo/partymonster.bse";
   const std::string installpath = Bse::Path::realpath (Bse::Path::abspath ("..")); // ebeast/..
@@ -284,7 +288,7 @@ v8bse_register_module (v8::Local<v8::Object> exports)
 
   // debugging aids:
   if (0)
-    Bse::printerr ("gdb %s %u -ex 'catch catch' -ex 'catch throw'\n", program_invocation_name, 
Bse::ThisThread::process_pid());
+    Bse::printerr ("gdb %s %u -ex 'catch catch' -ex 'catch throw'\n", Bse::string_split 
(program_invocation_name, " ", 1)[0], Bse::ThisThread::process_pid());
 
   // Ensure Bse has everything properly loaded
   bse_server.load_assets();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]