Permalink
Browse files

created bin/mozfee fore mozfee command

  • Loading branch information...
1 parent baf0ffe commit d6320b20bc959a79719827c26137a9588132fe21 @tshinohara committed Nov 24, 2012
Showing with 23 additions and 18 deletions.
  1. +8 −0 bin/mozfee
  2. +13 −0 lib/command.coffee
  3. +2 −18 lib/mozfee.coffee
View
@@ -0,0 +1,8 @@
+#!/usr/bin/env node
+
+var cs = require("coffee-script");
+var path = require('path');
+var fs = require('fs');
+var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
+
+require(lib + '/command').run();
View
@@ -0,0 +1,13 @@
+{Mozfee} = require './mozfee'
+
+run = ->
+ stdin = process.stdin
+ stdout = process.stdout
+ mozfee = new Mozfee stdin, stdout
+ mozfee.run()
+
+# Log an error.
+process.on 'uncaughtException', (err)->
+ console.error (err.stack or err.toString())
+
+exports.run = run
View
@@ -92,23 +92,7 @@ class Mozfee
@mozrepl.close()
@rl.close()
@rl.output.write '\n'
- @rl.input.destroy() ## ???
+ @rl.input.destroy()
@closed = true
-stdin = process.stdin
-stdout = process.stdout
-mozfee = new Mozfee stdin, stdout
-mozfee.run()
-
-# Log an error.
-process.on 'uncaughtException', (err)->
- stdout.write (err.stack or err.toString()) + '\n'
-
-# 微妙に二回Ctrl-cしたときの挙動が違う
-#
-#repl.on 'SIGINT', ->
-# console.log "sigint"
-
-#repl.on 'pause', ->
-# console.log "pause"
-
+exports.Mozfee = Mozfee

0 comments on commit d6320b2

Please sign in to comment.