Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add callbacks #12

Open
tauren opened this issue Sep 1, 2011 · 1 comment
Open

Add callbacks #12

tauren opened this issue Sep 1, 2011 · 1 comment

Comments

@tauren
Copy link
Contributor

tauren commented Sep 1, 2011

In my application's build process, I have the following tasks:

  • compile - compiles coffeescript, stylus, etc.
  • smoosh - smooshes everything
  • deploy - deploys resources to the right places

As far as I can tell, smoosh doesn't have any sort of callbacks. This means I cannot detect when smoosh has finished so that I can start the deploy task.

What am I missing? The commands can be chained and run in sequence, so internally it must be running synchronously or using callbacks. Could these callbacks be exposed? Or could a new chained function be created, maybe after() or finished():

smoosh.after(functin() {})

I've tried the following to see if it is synchronous, and the text "Smoosh Done" prints before the smoosh output:

smoosh.make './smoosh.json'
sys.print 'Smoosh Done'

As a workaround, I'm doing this (in coffee-script):

{spawn, exec} = require 'child_process'
sys = require 'sys'
smoosh = require 'smoosh'

printOutput = (process) ->
  process.stdout.on 'data', (data) -> sys.print data
  process.stderr.on 'data', (data) -> sys.print data

smoosh = (cb) ->
  cmd = 'smoosh ./smoosh.json'
  tasks = exec cmd, (err, stdout, stderr) ->
    cb err,stdout,stderr
  printOutput(tasks)
@aronwoost
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants