chiark / gitweb /
jst-lower: Trap add_log_message to print to somewhere we can see
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 19 Jul 2021 02:22:53 +0000 (03:22 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 19 Jul 2021 18:29:54 +0000 (19:29 +0100)
Otherwise, we just get an exception printed by nodejs which doesn't
actually include the message.

What we do here is print it to console.log where it will end up in
stderr, and *also* print a version to the machine-readable output
parsed by jst-lower.rs.

Currently jst-lower.rs bails on seeing it, which means these kind of
log messages are still fatal errors.  This is what we want - we don't
have any test cases that expect them.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
jstest/lower.nodejs

index 8a2973892bcdca1358cf279bb814162522163ddd..701a1f1c92c6fec9506777d36bf9d7fadb9500f0 100644 (file)
@@ -19,7 +19,10 @@ function api_piece(op, piece, p, args) {
   let s = op + ' ' + piece + ' ' + args.z + '\n';
   fs.writeSync(jstest_did, s);
 }
-
+function add_log_message(m) {
+  console.log('PLAYER LOG - ', m);
+  fs.writeSync(jstest_did, 'add_log_message ' + m);
+}
 
 /*
 console.log('-------------------- byhand --------------------');