1. firefly
  2. Eldis4

Commits

firefly  committed 98eb8d5

Improved ~z command.

* Command now calls a helper shellscript that runs the specified file.
* Added a little Z "library" that is concatenated with the executed snippet.

  • Participants
  • Parent commits 2b36c21
  • Branches default

Comments (0)

Files changed (3)

File modules/05-interpreters.js

View file
   exec: function(data) {
     var self    = this
       , options = {timeout:2000, killSignal:'SIGKILL'}
-      , tmpfile = 'tmp-eldis4-z'
-      , command = "java -jar stuff/Z3.jar -w '[' ']' '" + tmpfile + "'"
+      , tmpfile = '/tmp/tmp-eldis4-z-' + Math.random()
+    //  , command = "java -jar stuff/Z3.jar -w '[' ']' '" + tmpfile + "'"
+      , command = "stuff/z/runner.sh '" + tmpfile + "'"
 
     fs.writeFile(tmpfile, data.line, function(err) {
       if (err) {

File stuff/z/libff.zs

View file
+/home/firefly/prog/others/libff.zs

File stuff/z/runner.sh

View file
+#!/bin/sh
+
+classpath="$(dirname $1)"
+actualname="$1__"
+shortname="$(basename $actualname)"
+
+# Prepare the file to run
+cat stuff/z/libff.zs >"$actualname"
+echo ";" >>"$actualname"
+cat "$1" >>"$actualname"
+
+whitelist="unpack cast random math stdout"
+
+# Run it!
+java -jar stuff/z/Z3.jar -w '[' $whitelist ']' -cp "$classpath" "$shortname"