~homsar47's Profile User Rating: -----

Reputation: 1 Apprentice
Group:
Members
Active Posts:
31 (0.03 per day)
Joined:
06-October 13
Profile Views:
758
Last Active:
User is offline Dec 30 2015 12:43 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
Classic
Your Car:
Who Cares
Dream Kudos:
0
Icon   ~homsar47 was raised by a cup of coffee

Posts I've Made

  1. In Topic: CoffeeScript: giving simple child_process output

    Posted 27 Dec 2015

    Update, I got a little creative and found a way to not only fix the problem, but to add more options to using the cakefile. There's two tasks, assemble and link. Both of these just use exec to do one program, and the program naturally waits for the exec to finish before it exits.

    There's also an option called build that uses execSync to do both of these. The "at" tree of errors from before gets suppressed, fixing the problem in a nice way. I'm happy. :bananaman:

    ###
    cakefile to build pong game.
    
    running it is just like a makefile.
    
    to assemble: cake assemble
    to link: cake link
    to assemble and link: cake build
    to clean up build files: cake clean
    ###
    
    fs = require 'fs'
    {exec} = require 'child_process'
    {execSync} = require 'child_process'
    
    delete_file = (file) ->
      fs.exists file , (existent) ->
        if existent
          fs.unlink file
    
    
    task 'assemble', ->
      # run the assembler
      exec 'wla-z80 -o pong.asm pong.o', (err, stdout, stderr) ->
        process.stdout.write stdout if stdout
        process.stderr.write stderr if stderr
    
    
    task 'link', ->
      fs.openSync 'linkfile', 'w' # truncate linkfile
      fs.writeFileSync "linkfile", "[objects]\npong.o" # write to linkfile
    
      # run the linker
      exec 'wlalink -vd linkfile pong.sms', (err, stdout, stderr) ->
        process.stdout.write stdout if stdout
        process.stderr.write stderr if stderr
    
    task 'build', ->
      execSync 'cake assemble'
      execSync 'cake link'
    
    # clean just gets rid of pong.o and linkfile.
    task 'clean', ->
      delete_file('linkfile')
      delete_file('pong.o')
    
    

My Information

Member Title:
New D.I.C Head
Age:
15 years old
Birthday:
August 28, 2000
Gender:
Location:
C:/
Programming Languages:
C, VB.NET, C#, Assembly

Contact Information

E-mail:
Private

Friends

Comments

~homsar47 has no profile comments yet. Why not say hello?