日本語フォルダに対応してないのでシンボリックリンクで対応した.
以下ハマったこと
・node.jsのexecが/bin/sh -c を起動するが
PATHが通っている必要があるのでzshに迂回させた →/bin/sh -c zsh -c 'some command'
・シェルではシングルクオートとダブルクオートは意味が違う
・/bin/sh -c に引数つきのコマンドを渡すときは$変数を使って処理する
・open コマンドはaオプションで起動するアプリケーションを渡せる
前回のプロセスを再利用してくれるので便利
PreviewThesisView = require './preview-thesis-view' module.exports = activate: -> atom.workspaceView.command "preview-thesis:show", => @show() show: -> command = """ zsh -c 'cd /Users/shohei/Dropbox/Thesis && pdfplatex $0' main.tex """ command2 = """ zsh -c 'cd /Users/shohei/Dropbox/Thesis && open -a /Applications/Skim.app/Contents/MacOS/Skim $0' main.pdf """ console.log(command) exec = require('child_process').exec execCmd = (cmd) -> exec cmd, timeout: 20000 , (error, stdout, stderr) -> console.log "execCmd fired to " + cmd console.log stdout console.log "exec error: " + error if error isnt null return execCmd command execCmd command2 console.log('SUCCESS')